Skip to content

Instantly share code, notes, and snippets.

@ashaw
Created April 13, 2011 04:20
Show Gist options
  • Save ashaw/916957 to your computer and use it in GitHub Desktop.
Save ashaw/916957 to your computer and use it in GitHub Desktop.
def self.wb_gp_geojson
self.find_by_sql(
"SELECT z.zonedist,ST_AsGeoJSON(z.the_geom)
FROM zones AS z JOIN districts AS d ON
ST_Contains(d.the_geom, z.the_geom)
OR ST_Overlaps(d.the_geom,z.the_geom)
WHERE d.cd = 301;"
).map {|r|
{ :geojson => JSON.parse(r.st_asgeojson), :zonedist => r.zonedist }
}.to_json
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment