ruby - How can I use PostGIS functions in rails? -
the query i'd run is:
select zcta.geoid10, st_asgeojson(st_simplify(zcta.geom,500)) zcta zcta.geoid10 = '90210'
however in rails console when enter this:
testquery = "select zcta.geoid10, st_asgeojson(st_simplify(zcta.geom,500)) zcta zcta.geoid10 = '90210'" zcta.find_by_sql testquery
i following returned:
=> [#<zcta >]
if basic query asking result of column response expect. happens postgis functions. idea do?
alias calculated column , method added returned objects.
zcta. select("*, st_asgeojson(st_simplify(geom,500)) my_geo"). where(geoid10: '90210').each |result| puts result.my_geo end
Comments
Post a Comment