[osmosis-dev] nodes column in way table and way_nodes table

Brett Henderson brett at bretth.com
Sat Dec 24 01:39:42 GMT 2011


On 23 December 2011 00:09, Michel Seuthe <m.seuthe at googlemail.com> wrote:

> I got a question left... If i add the linestring-column to the ways table
> _after_ I imported all the data, is there a way to fill this column without
> re-import everything?
>

Yes in theory, no in practice.

Technically it's as simple as running this statement (it's in the
pgsnapshot_load_0.6.sql script).
UPDATE ways w SET linestring = (
    SELECT ST_MakeLine(c.geom) AS way_line FROM (
        SELECT n.geom AS geom
        FROM nodes n INNER JOIN way_nodes wn ON n.id = wn.node_id
        WHERE (wn.way_id = w.id) ORDER BY wn.sequence_id
    ) c
);

However for large datasets it is horrendously slow.  It is usually much
faster to get Osmosis to do it, especially if you have enough RAM to use
the nodeLocationStoreType=InMemory option on the --write-pgsql or
--write-pgsql-dump task.

The raw data load is relatively fast.  Building indexes and running CLUSTER
statements consumes most of the time.

Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osmosis-dev/attachments/20111224/a99d386d/attachment.html>


More information about the osmosis-dev mailing list