Hi all. I'm building an app with postgres, postgis and rails. Rails
seems to be choking when I try to do stuff that involves manipulating
the geometry column. For example:
self.neighborhood_id=ActiveRecord::Base.connection.execute("SELECT
neighborhoods.id FROM neighborhoods, items WHERE ST_Contains
(neighborhoods.the_geom,#{self.the_geom}.);")
Hi all. I'm building an app with postgres, postgis and rails. Rails
seems to be choking when I try to do stuff that involves manipulating
the geometry column.
[...]
Use GeoRuby and/or Spatial adapter. If you like, take a look at the
codebase for Quorum ( GitHub - marnen/quorum2: The Quorum calendar system. ), in which I use
PostgreSQL, PostGIS, GeoRuby, Spatial Adapter, and YM4R.
Hi, Marnen. Thanks for your thoughts. I have GeoRuby and spatial-
adapter installed, but I'm not seeing anything in the documentation
that looks similar to what I'm trying to do.
Hi, Marnen. Thanks for your thoughts. I have GeoRuby and spatial-
adapter installed, but I'm not seeing anything in the documentation
that looks similar to what I'm trying to do.
Well, your first query just seems to be constructing a Point, so you
could probably use one of the constructors on Point for that.
I *think* that your second query shouldn't be hard either, but let me
check the docs myself before I say that.
And both queries are subject to SQL injection. Never use string
interpolation like this in your queries -- always parameterize!