proj4rb icon indicating copy to clipboard operation
proj4rb copied to clipboard

Unable to read CRS WKT

Open seydar opened this issue 1 year ago • 1 comments

Using proj4rb v0.1.1, I get the following error when trying to use a specific WKT:

The WKT: "+proj=lcc +lat_1=33 +lat_2=45 +lat_0=0 +lon_0=-100 +x_0=0 +y_0=0 +ellps=WGS84 +towgs84=0,0,0,-0,-0,-0,0 +units=m +no_defs"

irb(main):001:0' require 'proj'
=> true
irb(main):002:0> Proj::Crs.new "+proj=lcc +lat_1=33 +lat_2=45 +lat_0=0 +lon_0=-100 +x_0=0 +y_0=0 +ellps=WGS84 +towgs84=0,0,0,-0,-0,-0,0 +units=m +no_defs"
Traceback (most recent call last):
        6: from /Users/ari/.asdf/installs/ruby/3.0.0/bin/irb:23:in `<main>'
        5: from /Users/ari/.asdf/installs/ruby/3.0.0/bin/irb:23:in `load'
        4: from /Users/ari/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        3: from (irb):2:in `<main>'
        2: from (irb):2:in `new'
        1: from /Users/ari/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/proj4rb-3.0.0/lib/proj/crs.rb:49:in `initialize'
Proj::Error (Invalid crs definition. Proj created an instance of: PJ_TYPE_OTHER_COORDINATE_OPERATION.)
irb(main):003:0>

It can be read by Python's pyproj, so I think this might be a bug in proj4rb.

seydar avatar Mar 06 '23 04:03 seydar

Because what is being returned is not a CRS but instead a coordinate operation. On that version of Proj, maybe PjObject.create will work (if it exists).

What will work is using the master branch. For that, use Proj::Conversion.new. I've spent a lot of time that last couple of weeks getting Proj updated to the Proj 9 and plan on cutting a new release this week.

cfis avatar Mar 06 '23 05:03 cfis