[OSM-dev] Osmosis - handling of linestring column

Lars Francke lars.francke at gmail.com
Wed Jan 14 17:58:58 GMT 2009


Hi,

Osmosis used to create a bbox column for the ways table. As I didn't
need this I replaced all its queries with queries to create and update
a LINESTRING-column instead. This works flawlessly and as I understand
this feature has since been added to Osmosis (I'm using 0.29.2). As
this update seems(!) to be the main source for slowdowns when applying
diffs I wondered what could be done about it.

The column needs to be updated when any of the nodes in a way gets updated.
In my hack and the current NodeDAO.java[1] file the
SQL_UPDATE_WAY_LINESTRING is executed once for each node that has been
updated and once again if the way has been updated (WayDAO.java). So a
way with 1000 nodes would be updated up to 1001 times. First question
is: Is my assumption correct? If not please ignore the rest ;-)

If it is correct a solution depends on the OSM-format. If a node is
updated does Osmosis produce a <modify>-element of all the related
ways? If yes the solution would be to simply delete the
SQL_UPDATE_WAY_LINESTRING from NodeDAO. If no we could compile a list
of all ways that are "touched" by the node updates and after
successfully importing everything update these ways. This wouldn't be
the best solution memory-wise and perhaps not even speed up things at
all because we'd have to find out which ways a node belongs to for
each updated node. But this is all I could come up with.

I don't have access to a running database at the moment as I'm
currently rebuilding the server so all this is not thoroughly checked.
But any comments are greatly appreciated.

Lars

[1] http://svn.openstreetmap.org/applications/utils/osmosis/trunk/src/com/bretth/osmosis/core/pgsql/v0_6/impl/NodeDao.java




More information about the dev mailing list