File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change 133133
134134function GFT. EPSG (crs:: CRS )
135135 str = proj_get_id_code (crs)
136+ if isnothing (str)
137+ error (" Could not parse $crs to EPSG code; it probably does not correspond to one." )
138+ end
136139 code = parse (Int, str)
137140 return GFT. EPSG (code)
138141end
Original file line number Diff line number Diff line change 489489 @test GFT. EPSG (crs) == GFT. EPSG (" EPSG:4326" )
490490
491491 @test convert (GFT. EPSG, crs) == GFT. EPSG (" EPSG:4326" )
492+
493+ # Test error handling when CRS doesn't have an EPSG code
494+ crs_without_epsg = Proj. CRS (" +proj=merc +lat_ts=56.5 +ellps=GRS80 +type=crs" )
495+ @test_throws r" Could not parse.*EPSG code" is GFT. EPSG (crs_without_epsg)
492496 @test convert (GFT. WellKnownText2, crs) == GFT. WellKnownText2 (crs)
493497 @test Proj. proj_get_id_code (convert (Proj. CRS, GFT. EPSG (" EPSG:4326" ))) ==
494498 Proj. proj_get_id_code (crs)
You can’t perform that action at this time.
0 commit comments