rgeo / rgeo-activerecord

RGeo ActiveRecord extensions and tools for spatial connection adapters
Other
89 stars 64 forks source link

SpatialConstantNode does not support RGeo::Feature objects #35

Closed YenTheFirst closed 3 years ago

YenTheFirst commented 8 years ago

The documentation for Arel.spatial indicates "This node wraps a spatial value (such as an RGeo feature or a text string in WKT format)."

And the code for visit_in_spatial_context seems to check for RGeo::Feature::Instance.

However, trying to actually use this functionality does not work.

Example:

def test_arel_visit_spatial_constant_node_rgeo_feature
  visitor = arel_visitor
  point = RGeo::Cartesian.preferred_factory().point(1.0, 2.0)
  sql = visitor.accept(Arel.spatial(point), Arel::Collectors::PlainString.new)
  assert_equal("ST_WKTToSQL('POINT (1.0 2.0)')", sql.value)
end

fails with

RuntimeError: unsupported: RGeo::Geos::CAPIPointImpl
keithdoggett commented 3 years ago

Fixed by #60