[OSM-dev] Fwd: Osmosis - Cutting out a bounding box from a diff file (.osc)
Gregory Williams
gregory at gregorywilliams.me.uk
Thu Sep 6 09:25:58 BST 2012
Stéphane,
Yes, you’re right in your analysis of how the co-ordinates are stored in the slim mode tables. This’ll help confirm it for you:
Executing this query against your Postgres database:
select
lon,
lat,
ST_X(ST_Transform(ST_SetSRID(ST_Point(lon / 100, lat / 100),900913),4326)),
ST_Y(ST_Transform(ST_SetSRID(ST_Point(lon / 100, lat / 100),900913),4326))
from planet_osm_nodes where id = 19;
Yields:
Lat;lon;st_x;st_y
679034492;-2304090;-0.206971841461138;51.9458701799331
Request the same node from the API:
<http://api.openstreetmap.org/api/0.6/node/19> http://api.openstreetmap.org/api/0.6/node/19
Yields:
…
<node id="19" … lat="51.9458753" lon="-0.20698" …>
…
Gregory
From: Stéphane Henriod [mailto:s at henriod.info]
Sent: 06 September 2012 06:56
To: Ramas
Cc: dev at openstreetmap.org
Subject: Re: [OSM-dev] Fwd: Osmosis - Cutting out a bounding box from a diff file (.osc)
Hi again everybody!
I am trying to implement the post-processing solution: removing all records in planet_osm_ways that are completely outside my bounding box. For this I first need to find out all the nodes outside the bounding box...
The problem is that the x and y coordinates of planet_osm_nodes seem to be plenty wrong. My first record, for instance, has
lat = 450768421
lon = 796483777
I assume that these are in srid 900913 but, if they are, they are way outside the limits of the 900913 srs. Actually, I just realised that they are systematically wrong by a factor 100. The correct coordinates should be something like:
lat = 4507684
lon = 7964837
Have I done something wrong? or is there a known (or unknown?) bug with osm2pgsql? The geometries of the "useful" tables (line, point, polygon, roads) seem correct, but the x/y columns of the temporary tableshave this problem...
Cheers
Stéphane
--
"Le mot progrès n'aura aucun sens tant qu'il y aura des enfants malheureux" -- Albert Einstein
"A journey does not need reasons. Before long, it proves to be reason enough in itself. One thinks that one is going to make a journey, yet soon it is the journey that makes or unmakes you." -- Nicolas Bouvier
Photos de voyages, photos de montagne: http://www.henriod.info <http://www.henriod.info/>
On Wed, Sep 5, 2012 at 5:25 PM, Ramas <ieskok at ramuno.lt> wrote:
You can check tool osmupdate which has option to clip data outside boundaries.
http://wiki.openstreetmap.org/wiki/Osmupdate#Applying_Geographical_Borders
On 5 September 2012 16:06, Stéphane Henriod <s at henriod.info> wrote:
thanks for your anwers!
But it looks like I have a problem now...
1. I need to keep the tables ways, rels and nodes because of the diff updates
2. Those 3 tables will continue growing up with each new diff, until I reach the storage capacity of the server
The only solution I see is a post-processing that will erase from PostGIS all the nodes lying outside my bounding box + all the ways using one of thses nodes + all the relations using one of thses nodes or one of these ways.
Except if anyone else has a magical solution...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20120906/fa04d279/attachment.html>
More information about the dev
mailing list