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

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -