[OSM-newbies] SQL to extract bounding box from OSM Database

Matthew Wechsler maw269 at gmail.com
Tue Mar 6 21:59:16 GMT 2012


Thanks Graham, I'll see if I can port your example to my case.

On Tue, Mar 6, 2012 at 3:24 PM, Graham Jones <grahamjones139 at gmail.com>wrote:

> Well, I use something like this in python:
>        sqlstr = "select id,name,operator,amenity,shop,landuse,"\
>                  "ST_Y(centroid(way)),ST_X(centroid(way))"\
>                  "from planet_osm_point,planet_osm_nodes where id=osm_id
> and way
>  && \
>         SetSRID('BOX3D(%f %f,%f %f)'::box3d,900913)" % \
>         (bbox.minx,bbox.miny,bbox.maxx,bbox.maxy)
>
> The relevant bounding box bit is: the Box3d bit.
>
> There may be better ways of doing this though - I remember having trouble
> with map projections to get it to work, which is what the SetSRID bit is
> doing.
>
> Graham.
>
>   On 6 March 2012 20:09, Matthew Wechsler <maw269 at gmail.com> wrote:
>
>>   I have a full OSM planet database import that I use for rendering
>> Mapnik tiles. I would like to use a bounding box to extract a geographic
>> region from the database to be used in rendering on a different server.
>> Does anyone know the SQL statement I could use to extract the BB info from
>> all the tables into a different DB?
>>
>> I have tried to use osm2pgsql to go the other way and use the BB to
>> import data into another DB but have lately been running into memory issues
>> on the import (even though I'm using --slim mode). I am using Windows so I
>> am only able to use the old osm2pgsql binary that has been created a few
>> years ago.
>> Thanks,
>> Matt
>>
>> _______________________________________________
>> newbies mailing list
>> newbies at openstreetmap.org
>> http://lists.openstreetmap.org/listinfo/newbies
>>
>>
>
>
> --
> Graham Jones
> Hartlepool, UK.
>
>
> _______________________________________________
> newbies mailing list
> newbies at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/newbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/newbies/attachments/20120306/60e38cce/attachment.html>


More information about the newbies mailing list