diff --git a/src/coord.jl b/src/coord.jl index b1880c9..4c0997a 100644 --- a/src/coord.jl +++ b/src/coord.jl @@ -93,7 +93,11 @@ function Transformation( ctx::Ptr{PJ_CONTEXT}=C_NULL ) pj = proj_create(pipeline, ctx) - @assert !Bool(proj_is_crs(pj)) "Not a transformation (but a CRS):\n$pipeline" + if Bool(proj_is_crs(pj)) + throw(ArgumentError("""Cannot create a Transformation from a single CRS. + Pass either one pipeline or a source and target CRS. + CRS given: $(repr(pipeline))""")) + end pj = always_xy ? normalize_axis_order!(pj; ctx) : pj return Transformation(pj, direction) end diff --git a/test/libproj.jl b/test/libproj.jl index 3da1f80..c5da2ad 100644 --- a/test/libproj.jl +++ b/test/libproj.jl @@ -166,7 +166,7 @@ end @test inv(PJ_IDENT) == PJ_IDENT @test inv(PJ_INV) == PJ_FWD - @test_throws AssertionError Proj.Transformation("EPSG:28992") + @test_throws ArgumentError Proj.Transformation("EPSG:28992") trans = Proj.Transformation("+proj=pipeline +ellps=GRS80 +step +proj=merc +step +proj=axisswap +order=2,1") end