[OSM-dev] Querying OSM data for a region

Pulkit Bhuwalka pulkit.bosco05 at gmail.com
Mon Nov 10 06:04:54 UTC 2014


Hi Paul,

Thanks for replying. My comments are inline.

On Mon, Nov 10, 2014 at 12:05 AM, Paul Norman <penorman at mac.com> wrote:

>  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.
>

Sorry I wasn't clear. I understand that I can use a PostgreSQL driver from
any language. I was wondering if there is an OpenStreetMap library/API
which provides data access to the database. For instance where I can run
queries like "return all nodes with a tag within a geometric bound". I
thought there might be one since Mapnik and other services might need
similar data access APIs.


>  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.
>

Ok. So all roads and streets should be available in planet_osm_lines and
planet_osm_polygons with "highway"/"landuse" or some similar column on. Is
there a document which explains these? I want to use the data to 3D render
roads, so probably I might need to use planet_osm_roads.


>
>
>  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.
>

Ok. Yes, I'll take a look at that. I was just wondering if there is a data
access API, similar to XAPI for editing the database that exists.


>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev
>
>
Thanks so much for your help.

Best,
Pulkit


-- 
Pulkit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20141110/6582baa9/attachment-0001.html>


More information about the dev mailing list