RGeo::Feature.cast does not convert between projections

المشرف العام

Administrator
طاقم الإدارة
I am attempting to cast a MultiLineString feature in WGS84 to UTM33N using RGeo.

Unfortunately, RGeo::Feature.cast, instead of casting the feature to the desired projection, returns the original feature unchanged, as the checks at the end show. Why does the conversion result like this? What else is needed to convert between these two projections in RGeo?

require 'rgeo' require 'rgeo-geojson' utm_33n_factory = RGeo::Geographic.spherical_factory:)srid => 32633) wgs_84_factory = RGeo::Geographic.spherical_factory:)srid => 4326) geo_json = '{"type":"Feature","properties":{"City":"PRG","Name":"Z","Color":"green","Description":"Pohorelec"},"geometry":{"type":"MultiLineString","coordinates":[[[14.389935,50.087667,0],[14.389219,50.08756,0],[14.389093,50.087525,0],[14.388617,50.087394,0]]]}}' json_geom = RGeo::GeoJSON.decode(geo_json, geo_factory: wgs_84_factory, json_parser: :json).geometry projected = RGeo::Feature.cast json_geom, factory: utm_33n_factory, project: true puts json_geom.equal? projected # => true puts projected.srid # => 4326

أكثر...
 
أعلى