Can't convert from Irish to British grid using CoordRefSystems

I’m trying to convert coordinates from Irish to British national grid. I can do this in Proj, but am encountering some compatibility issues. I thought the easiest solution might be to remove any direct dependence on Proj and use CoordRefSystems.jl

    using CoordRefSystems
    x= 337492.0
    y= 374065.0
    ing = CoordRefSystems.get(EPSG{29903}) # Irish National Grid
    bng = CoordRefSystems.get(EPSG{27700}) # British National Grid
    println(ing(x, y))
    bng_xy = CoordRefSystems.convert(bng, ing(x, y))

I took this from the examples in the docs, here.

However, this doesn’t work. What am I doing wrong?

I get the following output:

TransverseMercator{Ire65}(x: 337492.0 m, y: 374065.0 m)

ERROR: MethodError: no method matching transform(::Type{Ire65}, ::Type{OSGB36})
The function `transform` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  transform(::Type{<:WGS84}, ::Type{<:OSGB36})
   @ CoordRefSystems C:\Users\TGebbels\.julia\packages\CoordRefSystems\V4i7O\src\transforms.jl:39
  transform(::Type{<:Ire65}, ::Type{<:WGS84})
   @ CoordRefSystems C:\Users\TGebbels\.julia\packages\CoordRefSystems\V4i7O\src\transforms.jl:38
  transform(::Type{<:WGS84}, ::Type{<:GGRS87})
   @ CoordRefSystems C:\Users\TGebbels\.julia\packages\CoordRefSystems\V4i7O\src\transforms.jl:39
  ...

Stacktrace:
 [1] convert(::Type{Cartesian{OSGB36}}, coords::Cartesian3D{Ire65, Unitful.Quantity{Float64, 𝐋, Unitful.FreeUnits{…}}} )
   @ CoordRefSystems C:\Users\TGebbels\.julia\packages\CoordRefSystems\V4i7O\src\crs\basic.jl:361
 [2] convert(::Type{GeodeticLatLon{…}}, coords::GeodeticLatLon{Ire65, Unitful.Quantity{…}})
   @ CoordRefSystems C:\Users\TGebbels\.julia\packages\CoordRefSystems\V4i7O\src\crs\geographic\geodetic.jl:239
 [3] convert(::Type{…}, coords::TransverseMercator{…})
   @ CoordRefSystems C:\Users\TGebbels\.julia\packages\CoordRefSystems\V4i7O\src\crs\projected.jl:194
 [4] top-level scope
   @ REPL[57]:1 

Hi @TimG , CoordRefSystems.jl doesn’t support custom grids yet, but we plan to add this feature very soon, to fully replace the PROJ C library.

To give some extra context, some countries provide “adjustments” to coordinate conversions, which are saved as grid data. We need to load these artifacts and apply the adjuments in the case of the National British grid, for example.

3 Likes