ERROR: ArgumentError: EPSG/ESRI code for the ESRI ID "GCS_North_American_1983" not found in dictionary

Any one can help me with this error when attempting read a shape file using GeoIO

using GeoIO
df_lo = GeoIO.load("data/processed/low/us_division_2018/us_division_2018.shp")

>>>
ERROR: ArgumentError: EPSG/ESRI code for the ESRI ID "GCS_North_American_1983" not found in dictionary.

Equivalent version which works perfectly fine using python Geopandas

# Read Low Resolution DataFrame
df_lo = gpd.read_file("data/processed/low/us_division_2018/us_division_2018.shp")
df_lo.rename(columns = {"total_spec" : "total_specimens", "total_flu_" : "total_flu_cases"}, inplace = True)
df_lo

>>>

area	total_specimens	total_flu_cases	geometry
0	New England	20954	2964	MULTIPOLYGON (((-68.37659 44.11376, -68.37538 ...
1	Middle Atlantic	80827	2266	MULTIPOLYGON (((-72.03496 41.25546, -72.02944 ...
2	East North Central	62901	3762	MULTIPOLYGON (((-82.73571 41.60336, -82.7188 4...
3	West North Central	9762	2948	POLYGON ((-104.0577 44.99743, -104.05021 44.99...
4	South Atlantic	12874	5185	MULTIPOLYGON (((-75.5708 39.62677, -75.55945 3...
5	East South Central	1532	484	MULTIPOLYGON (((-88.04374 30.51742, -88.03661 ...
6	West South Central	14849	873	MULTIPOLYGON (((-88.88145 30.0532, -88.87048 3...
7	Mountain	42251	5961	POLYGON ((-120.00574 39.22866, -120.00526 39.2...```

Is that the whole error message? Because we had this discussion recently with a longer error message, which also tells the user (more or less) what to do, and I think @juliohm was going to improve that message further.

1 Like

this is the entire error message.

ERROR: ArgumentError: EPSG/ESRI code for the ESRI ID “GCS_North_American_1983” not found in dictionary.
Please check CoordRefSystems.jl/src/strings.jl at main · JuliaEarth/CoordRefSystems.jl · GitHub
If you know the EPSG/ESRI code of a given ESRI WKT string, please submit a pull request.

Stacktrace:
[1] string2code(crsstr::String)
@ CoordRefSystems ~/.julia/packages/CoordRefSystems/7aSTQ/src/strings.jl:65
[2] get(crsstr::String)
@ CoordRefSystems ~/.julia/packages/CoordRefSystems/7aSTQ/src/get.jl:10
[3] crstype
@ ~/.julia/packages/GeoIO/6XB6W/src/conversion.jl:55 [inlined]
[4] togeometry(::GeoInterface.MultiPolygonTrait, geom::Shapefile.Polygon, crs::GeoFormatTypes.ESRIWellKnownText{GeoFormatTypes.CRS})
@ GeoIO ~/.julia/packages/GeoIO/6XB6W/src/conversion.jl:115
[5] geom2meshes
@ ~/.julia/packages/GeoIO/6XB6W/src/conversion.jl:120 [inlined]
[6] geom2meshes
@ ~/.julia/packages/GeoIO/6XB6W/src/conversion.jl:119 [inlined]
[7] _broadcast_getindex_evalf
@ ./broadcast.jl:709 [inlined]
[8] _broadcast_getindex
@ ./broadcast.jl:682 [inlined]
[9] getindex
@ ./broadcast.jl:636 [inlined]
[10] copy(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(GeoIO.geom2meshes), Tuple{Vector{Union{…}}, Base.RefValue{GeoFormatTypes.ESRIWellKnownText{…}}}})
@ Base.Broadcast ./broadcast.jl:942
[11] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(GeoIO.geom2meshes), Tuple{Vector{Union{…}}, Base.RefValue{GeoFormatTypes.ESRIWellKnownText{…}}}})
@ Base.Broadcast ./broadcast.jl:903
[12] asgeotable(table::Shapefile.Table{Union{Missing, Shapefile.Polygon}})
@ GeoIO ~/.julia/packages/GeoIO/6XB6W/src/utils.jl:13
[13] load(fname::String; repair::Bool, layer::Int64, lenunit::Unitful.FreeUnits{(m,), 𝐋, nothing}, kwargs::@Kwargs{})
@ GeoIO ~/.julia/packages/GeoIO/6XB6W/src/load.jl:103
[14] load(fname::String)
@ GeoIO ~/.julia/packages/GeoIO/6XB6W/src/load.jl:34
[15] top-level scope
@ REPL[5]:1
Some type information was truncated. Use show(err) to see complete types.

A quick google search suggest that ESRI code for “GCS_North_American_1983” is epsg:4269, see NAD83 - EPSG:4269

Getting the shape file to work with GeoIO requires a small update to GitHub - JuliaEarth/CoordRefSystems.jl: Unitful coordinate reference systems for geographic maps in Julia

The update should just be a small fast code changes. After that you will either have to wait for the release of the new CoordRefSystems.jl version or get the new version directly from Github.

2 Likes

I have made a PR to add this code now. The maintenance of CoordRefSystems.jl (@juliohm and @eliascarv) are located in Brazil so it will probably take at least half a day before they see it.

Alternately, you can try in a clean environment to first add CoordRefSystems.jl from my branch and then add GeoIO.

1 Like

Thank you @nilshg for the ping, and @lupemba for the fix.

The PR has been merged, and a patch version has been released:

@imantha please update your environment after the PR above is merged by the bot.

2 Likes