如何使用共享数据库在Heroku上进行GIS查询? [英] How do you do GIS queries on Heroku using the shared database?

查看:148
本文介绍了如何使用共享数据库在Heroku上进行GIS查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张地理编码的经纬度表。我希望我的数据库查询返回一个已过滤的列表,按照距离固定点的距离排序。

I have a table of geocoded locations with latitude and longitude. I'd like my database query to return a filtered list of them, ordered by distance from a fixed point.

我已经探索了几个选项:

There are a few options which I've explored:


  • Postgresql的earthdistance contrib 可能最接近我的需求;然而,我发现没有迹象表明它安装在heroku的数据库服务器上。

  • PostGIS是最常用的GIS解决方案,但是heroku没有安装它,并且确认了heroku支持他们不打算在不久的将来这样做。

  • Postgresql's earthdistance contrib is probably closest to my needs; however, I've found no indication that this is installed on heroku's db server.
  • PostGIS is the most often prescribed solution for GIS, but heroku does not have it installed, and heroku support confirmed that they have no intention of doing so in the near future.

我需要一个适用于Rails3的解决方案。

I'll need a solution which works with Rails3.

如果没有更好的选择,我将不得不实现我自己的半束缚函数,这看起来好像重新发明了轮子。任何更好的选择?

If there are no better options, i'll have to implement my own haversine function, which sure seems like reinventing the wheel. Any better options?

推荐答案

我现在(2011年7月)推荐使用geocoder

I would now (July 2011) recommend using geocoder

gem 'geocoder'

http://www.rubygeocoder.com/

你可以也可以像我之前提到的那样使用geokit-rails3,但它并不完整并且不会被维护。

You could also use geokit-rails3 as I previously mentioned but it isn't complete and isn't maintained.

gem 'geokit-rails3'

http://github.com/jlecour/geokit-rails3

这篇关于如何使用共享数据库在Heroku上进行GIS查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆