Closed allthesignals closed 3 years ago
This is possible using a model's arel_table
and st_function
.
locations = Location.arel_table
query = location.project(location[:geom].st_function("ST_Transform", [4326], [true, true, false]).as('the_geom_wgs84'))
Location.find_by_sql(query.to_sql)
How can I transform a geometry from an SRID to another SRID?
In GeoDjango, I can accomplish this with #transform: https://docs.djangoproject.com/en/1.11/ref/contrib/gis/geoquerysets/#transform
In PostGIS, I can
SELECT ST_Transform(geometry, 4326) AS the_geom_wgs84
.Is it possible with this gem?