Closed printercu closed 3 years ago
Hi! I'm trying to investigate why RGeo features are supported in simple arel functions like = but not as arguments for functions:
=
2.3.3 (main):0[22] > location = Building.arel_table[:location]; 2.3.3 (main):0[23] > point = RGeo::Geographic.spherical_factory(srid: 4326).point(1, 2); 2.3.3 (main):0[24] > location.eq(point).to_sql => "\"buildings\".\"location\" = '0020000001000010e63ff00000000000004000000000000000'" 2.3.3 (main):0[25] > location.st_function('ST_DWithin', point, 1, [false, true, true, false]).to_sql Arel::Visitors::UnsupportedVisitError: Unsupported argument type: RGeo::Geographic::SphericalPointImpl. Construct an Arel node instead.
I'm using point.to_s in function and it wraps value with ST_GeomFromEWKT. Is it the right way or should RGeo features be used in queries without .to_s?
point.to_s
ST_GeomFromEWKT
.to_s
Fixed by #60
Hi! I'm trying to investigate why RGeo features are supported in simple arel functions like
=
but not as arguments for functions:I'm using
point.to_s
in function and it wraps value withST_GeomFromEWKT
. Is it the right way or should RGeo features be used in queries without.to_s
?