How can I represent RGeo::Point ( CAPI implementation ) in some way where I don't have to convert it once more in Sql?

Now I have something like this:

class Poly
  scope :enclosing ->(geom) do
    where ["ST_Contains(poly.geom, ST_GeomFromText( ? , 4326))",
p = RGeo::Geos.factory(srid: 4326).point(10, 20)

This way the point first gets represented as "POINT (10.0 20.0)" , then converted to geometry by ST_GeomFromText. Is there a shortcut? PostGIS geometry items look like 0101000020E6100000CC79C6BE64E13D4046F6F708EB8F4E40 and have SRID already encoded, but RGeo::Point.as_binary returns something very different and not acceptable by PostGIS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.