[OSM-dev] querying mapnik data
Jochen Topf
jochen at remote.org
Thu Dec 27 15:21:23 GMT 2007
On Thu, Dec 27, 2007 at 03:43:32PM +0100, Joerg Ostertag (OSM Munich/Germany) wrote:
> I would like to query mapnik data directly from the postgis Database. Can
> anyone give me a hint which SELECT statements I would need to querey all
> streets in a bounding Box or in the (surrounding) area of a point. I want to
> use this inside of osmtrackfilter.pl to get and compare against the already
> existing osm segments(ways)
> Any hints are welcome.
For example:
SELECT name FROM planet_osm_roads WHERE distance(way,
GeomFromText('POINT(856371.58 6683083.41)', 3395)) < 1000;
will find names of all streets within 1km distance to point 856371.58
6683083.41 (Mercator coordinates).
Mapnik uses the 4 tables planet_osm_line,planet_osm_point, planet_osm_polygon,
and planet_osm_roads. Each has a column named "way" that contains the
geometry. Thats the one you have to query using the special PostGIS
functions. See http://postgis.refractions.net/docs/ for these. (I have
no idea why they are all called "way" when some of them describe points
or polygons.)
The 3395 ist the so-called SRID, the projection used. Mapnik db uses
WGS84 Mercator.
Jochen
--
Jochen Topf jochen at remote.org http://www.remote.org/jochen/ +49-721-388298
More information about the dev
mailing list