[OSM-dev] Querying OSM data for a region

Paul Norman penorman at mac.com
Mon Nov 10 05:05:48 UTC 2014


On 11/9/2014 3:46 PM, Pulkit Bhuwalka wrote:
> 1. Download bulk data from OSM using API (This is a small region)
> 2. Setup Postgres with PostGIS extension.
> 3. Import data into PostGIS database using osm2pgsql
>
> I am not sure about the next step. What api should I use to query the 
> database? I suppose there exists some data access API which Mapnik and 
> other services use for drawing.
The database you have created is a PostgreSQL database, and there are 
libraries in most languages for connecting to one.
> Also, I don't quite understand the DB structure and the data encoding 
> within it. There are a few tables created by PostGIS (spatial_ref_sys 
> etc.) and a few tables created by OSM (planet_osm_*). I am unsure 
> about the relation between these tables.
The point, line, and polygon tables contain points, lines and polygons 
respectively. The roads table contains a subset of data for low-zoom 
rendering and is more complicated to use.

> I recently also stumbled upon the Overpass API 
> <http://wiki.openstreetmap.org/wiki/Overpass_API> which seems to do 
> something similar. My requirements are actually pretty simple. I need 
> some simple querying to experiment with some rendering of my own.
You should look at the documentation for whatever rendering 
library/server you want to use. It's also worth reading through the 
documentation at 
https://github.com/openstreetmap/osm2pgsql/tree/master/docs for more 
information on osm2pgsql.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20141109/14425115/attachment.html>


More information about the dev mailing list