Skip to content

Commit

Permalink
Add an error message for unmapped EPSG/ESRI codes (#83)
Browse files Browse the repository at this point in the history
* Add an error message for unmapped EPSG/ESRI codes

* Apply suggestions

* Update src/codes.jl

Co-authored-by: Júlio Hoffimann <[email protected]>

* Update src/codes.jl

Co-authored-by: Júlio Hoffimann <[email protected]>

---------

Co-authored-by: Júlio Hoffimann <[email protected]>
  • Loading branch information
eliascarv and juliohm authored Jun 11, 2024
1 parent 7d5c0ab commit 729a3d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/codes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ abstract type ESRI{Code} end
Returns a CRS type that has the EPSG/ESRI `code`.
"""
function get end
function get(code)
throw(ArgumentError("""
The provided code $code is not mapped to a CRS type yet.
Please check https://github.com/JuliaEarth/CoordRefSystems.jl/blob/main/src/codes.jl
If you know the CRS type of a given code, please submit a pull request.
"""))
end

# ----------------
# IMPLEMENTATIONS
Expand Down
1 change: 1 addition & 0 deletions test/codes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
@test CoordRefSystems.get(ESRI{54042}) === WinkelTripel{WGS84Latest}
@test CoordRefSystems.get(ESRI{102035}) === CoordRefSystems.Orthographic{90.0u"°",0.0u"°",true,WGS84Latest}
@test CoordRefSystems.get(ESRI{102037}) === CoordRefSystems.Orthographic{-90.0u"°",0.0u"°",true,WGS84Latest}
@test_throws ArgumentError CoordRefSystems.get(EPSG{1})
end

0 comments on commit 729a3d1

Please sign in to comment.