PostGIS笔记(下)

上篇说了为什么用Geography,这篇具体讲怎么取“范围n米以内的数据”。

Rails里运行Migration,建Portal Model,以下是Schema

距离东京站1km内所有的portals

  • ST_Distance

    float ST_Distance(geography gg1, geography gg2, boolean use_spheroid);

  • ST_DWithin

    boolean ST_DWithin(geography gg1, geography gg2, double precision distance_meters, boolean use_spheroid);

结果:

Continue reading “PostGIS笔记(下)”