-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
I'm fairly certain that I'm doing something wrong here but when using a the active-record rgeo gem and encoding a single polygon, I'm able to make a db query like this:
This works:
MyModel.where("latlon && ?", poly) where the latlon column is a point type and the poly represents a regular polygon that I generated from a linestring of coordinates using this factory: factory = RGeo::Geographic.spherical_factory(:srid => 4326)
This doesn't:
Using this gem, I encode a geojson multipolygon successfully using: poly = RGeo::GeoJSON.decode(mp.to_json, :json_parser => :json) Then I extract the geometry using:
poly = poly.geometry and that also seems to be successful. Now I try to run that same query from above:
MyModel.where("latlon && ?", poly) but this time it fails with this error:
PG::DatatypeMismatch at /api/v1/listings/polygon_search.json
============================================================
> ERROR: argument of WHERE must be type boolean, not type record
LINE 1: SELECT "my_models".* FROM "my_model" WHERE (latlon && '002000...