@@ -29,15 +29,25 @@ Proj(code::Type{<:ESRI}) = Proj{CoordRefSystems.get(code)}()
2929
3030parameters (:: Proj{CRS} ) where {CRS} = (; CRS)
3131
32- applycoord (:: Proj{CRS} , p:: Point ) where {CRS} = Point (convert (CRS, coords (p)))
32+ # convert the CRS and preserve the manifold
33+ applycoord (:: Proj{CRS} , p:: Point{<:🌐} ) where {CRS<: Basic } = Point {🌐} (convert (CRS, coords (p)))
34+
35+ # convert the CRS and (possibly) change the manifold
36+ applycoord (:: Proj{CRS} , p:: Point{<:🌐} ) where {CRS<: Projected } = _proj (CRS, p)
37+ applycoord (:: Proj{CRS} , p:: Point{<:🌐} ) where {CRS<: Geographic } = _proj (CRS, p)
38+ applycoord (:: Proj{CRS} , p:: Point{<:𝔼} ) where {CRS<: Basic } = _proj (CRS, p)
39+ applycoord (:: Proj{CRS} , p:: Point{<:𝔼} ) where {CRS<: Projected } = _proj (CRS, p)
40+ applycoord (:: Proj{CRS} , p:: Point{<:𝔼} ) where {CRS<: Geographic } = _proj (CRS, p)
3341
3442applycoord (:: Proj , v:: Vec ) = v
3543
3644# --------------
3745# SPECIAL CASES
3846# --------------
3947
40- applycoord (t:: Proj , g:: Primitive ) = TransformedGeometry (g, t)
48+ applycoord (t:: Proj{<:Projected} , g:: Primitive{<:🌐} ) = TransformedGeometry (g, t)
49+
50+ applycoord (t:: Proj{<:Geographic} , g:: Primitive{<:𝔼} ) = TransformedGeometry (g, t)
4151
4252applycoord (t:: Proj , g:: RectilinearGrid ) = applycoord (t, convert (SimpleMesh, g))
4353
@@ -54,3 +64,9 @@ function Base.show(io::IO, ::MIME"text/plain", t::Proj{CRS}) where {CRS}
5464 println (io)
5565 print (io, " └─ CRS: $CRS " )
5666end
67+
68+ # -----------------
69+ # HELPER FUNCTIONS
70+ # -----------------
71+
72+ _proj (CRS, p) = Point (convert (CRS, coords (p)))
0 commit comments