How can I find N closest points sorted by distance using OpenStreetMap data?

المشرف العام

Administrator
طاقم الإدارة
I'm brand new to GIS and I'm running into a roadblock trying to figure this one out.

Here's my setup:


  • PostgreSQL 9.3
  • PostGIS 2.1
  • GeoFabrik OpenStreetMap data for US Northeast
  • Following this guide
  • Using osm2pgsql to import the data:

    osm2pgsql --create --slim --cache 2048 --cache-strategy sparse --number-processes 8 --hstore-all --style /usr/share/osm2pgsql/default.style us-northeast-latest.osm.pbf

Following the guide, when I create the indexes and import the Overpass API data, this query successfully returns results as it should:

SELECT name, ST_Distance(geog,loc) As dist FROM planet_osm_point CROSS JOIN geography(ST_Point(-122.66317,45.5284571)) As loc WHERE tags @> 'amenity=>restaurant, cuisine=>mexican'::hstore AND ST_DWithin(geog,loc,2*1000) ORDER BY dist LIMIT 5; But when I do everything the same except use Geofabrik data and change the coordinates (Boston, MA: 42.360087, -71.058882 for example), I get no results.

What's going on?



أكثر...
 
أعلى