[OSM-dev] Patch for Osmosis--complete ways and relations

Karl Newman siliconfiend at gmail.com
Tue Oct 23 05:56:12 BST 2007


I have modified the Osmosis area filter task to optionally include all
available nodes which are part of a way which has at least one node in
the filtered area (this is similar to how the API returns data in a
bounding box). It does this by streaming all nodes, then all ways,
then all relations into temporary files (using SimpleObjectStore),
then reading them back and passing on the appropriate items to the
sink. To enable this mode, just add the parameter "completeWays=yes"
to the --bounding-box or --bounding-polygon task.

I also added a "completeRelations" option which will include relations
which are referenced by other relations which have at least one member
involved in the original filtered area (currently the inclusion of the
referenced relation is haphazard depending on the order in which the
relations are read). The correct handling of this is a little more
fuzzy to me and maybe it needs more options to give more control over
the process such as:
1. pull in all members referenced by the relation to make the relation
referentially complete (could potentially pull in the entire planet)
2. omit the relation if not all members are available
3. mangle the relation to only include members which are available in
the filtered area (this is what it does now)
Anyway, I just threw that option in there; it wasn't my main focus.

Anyway, take a look at the attached patch and let me know what you
think. I'm not a Java expert so I'm not sure if it needs some
exception handling or if some code needs to be wrapped in a
try-finally block (particularly the release call for the
ReleasableIterators). I did minimal testing of the completeWays option
but no testing of the completeRelations option. If this patch is
accepted I'll add the usage to the Wiki page.


Karl Newman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Osmosis_completeWays.patch
Type: application/octet-stream
Size: 15686 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20071022/90108b49/attachment.obj>

More information about the dev mailing list