RGeo Factories and contians? in geographic domain

Skip to first unread message

Pratuat Amatya

Mar 10, 2014, 3:22:19 AM3/10/14
to rgeo-...@googlegroups.com
I am new to GIS and RGeo.

I was using RGeo::Geographics.spherical_factory for creating polygons and point with lat/lon data.

I am getting following errors on polygon.contains?(point)
RGeo::Error::UnsupportedOperation: Method Geometry#contains? not defined.
from /Users/pratuat/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rgeo-0.3.20/lib/rgeo/feature/geometry.rb:409:in `contains?'

I noticed another post recommended the usage of RGeo::Geos.factory instead but again GEOS is said to be implementation of the SFS using a Cartesian coordinate system. 

So whats the right way to achieve polygon.contains?(point) in geographic coordinate system.

PS: Going through Daniel Azuma's article series, I realized the spatial data I will be using are locale specific and hence it would be good idea to switch to simple_mercator_factory but again the requirements is such that I need to store the locaiton data in lat/lon. How can I work that out ?

Ken-ichi Ueda

Oct 29, 2014, 7:12:16 PM10/29/14
to rgeo-...@googlegroups.com
+1. If this isn't implemented, the documentation should say so. If anyone can recommend an alternative strategy that would be helpful. I'm particularly interested using contains? for polygons that cross longitude 180.


Jules Ivanic

Aug 24, 2015, 11:37:26 AM8/24/15
to RGeo-Users

You have to use the RGeo::Geos.factory

Like this for example : 

  self.rgeo_factory_generator = RGeo::Geos.factory_generator
(:columnn_name, RGeo::Geographic.simple_mercator_factory)

And one thing very important is to install the system dependancies BEFORE installing the gem, as explain in the last comment of this issue : https://github.com/rgeo/rgeo/issues/52


Nov 11, 2016, 5:36:02 PM11/11/16
to RGeo-Users

did you figure out an answer for that ?
Reply all
Reply to author
0 new messages