Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to postGIS, and am looking to use a spatial database with my Rails app (specifically, to retrieve points from the database that are within the bounding box of a Google Maps viewport). I posted a question on Stack Overflow with a few more details ( ), before coming across this site. I was following the tutorial at, but my implementation doesn't really seem to work - when zoomed in, the points don't appear as expected (but some appear when zoomed further out, although not those near the international date line). I'm using the spatial_adapter and GeoRuby gems at the moment - are there any good tutorials out there on how to begin integrating postGIS with Rails? From what I've read, it seems like using the geography type would be a good start for my project, but unfortunately I don't believe GeoRuby supports it. Any help/suggestions would be greatly appreciated!

share|improve this question
I don't know whether you have seen it, but there is a really in depth 9 part series of blog posts by Daniel Azuma, author of the RGeo gem starting at – Kelso May 10 '12 at 0:53
up vote 4 down vote accepted

The answer on Stackoverflow echos my thoughts: first, determine if the issue is in the google maps implementation or with the database results. I'd try installing QGIS, and point it at your PostGIS database -- if all the data shows up there fine, and zooming works as expected, the data is correct in the database.

From your example query, here's a quick map of the bounding box: bbox example

That is consistent with the parameters you're sending, so try another one that fails, check the logs and try the query directly against the database to see if its sending the results you want. Step backward from there till you've isolated the component that's failed. Hope that helps!

share|improve this answer
Thanks for your help - once I got my database on QGIS I spotted the problem immediately - I had the x/y and lng/lat correlation mixed up. Massive n00b error - it works perfectly now!! – Sonia Aug 25 '10 at 20:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.