I ran into a problem using the --bounding-polygon
option in osmosis.
When you deploy data into fresh DB this set of parameters helps you to achieve your goal by clipping data using predefined *.poly
(bounding-polygon).
osmosis \
--read-pbf file=some.osm.pbf \
--bounding-polygon file=clip.poly
--write-apidb …
But when you try to do the same for stream of changes (*.osc) osmosis throw an error
Task 2-bounding-polygon does not support data provided by default pipe stored at level 1 in the default pipe stack.
osmosis \
--read-replication-interval workingDirectory=$DATA_DIR/replication_in \
--bounding-polygon file="$poly_file" \
--wxc $DATA_DIR/osm.osc
👈 see log here
osmosis \
--read-replication-interval workingDirectory=$DATA_DIR/replication_in \
--bounding-polygon file="$poly_file" \
--wxc $DATA_DIR/osm.osc
Feb 26, 2023 3:42:10 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.48.3
Feb 26, 2023 3:42:10 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Feb 26, 2023 3:42:10 PM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Task 2-bounding-polygon does not support data provided by default pipe stored at level 1 in the default pipe stack.
at org.openstreetmap.osmosis.core.pipeline.common.PipeTasks.retrieveTask(PipeTasks.java:159)
at org.openstreetmap.osmosis.core.pipeline.common.TaskManager.getInputTask(TaskManager.java:165)
at org.openstreetmap.osmosis.core.pipeline.v0_6.SinkSourceManager.connect(SinkSourceManager.java:51)
at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.connectTasks(Pipeline.java:74)
at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.prepare(Pipeline.java:116)
at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:86)
at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:321)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:234)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
or in case with local osm.osc
file, we see the same behaviour
osmosis \
--rxc $DATA_DIR/osm.osc \
--bounding-polygon file="$poly_file" \
--wxc $DATA_DIR/osmc.osc
👈 see log here
osmosis \
--rxc $DATA_DIR/osm.osc \
--bounding-polygon file="$poly_file" \
--wxc $DATA_DIR/osmc.osc
Feb 26, 2023 3:45:59 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.48.3
Feb 26, 2023 3:45:59 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Feb 26, 2023 3:45:59 PM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Task 2-bounding-polygon does not support data provided by default pipe stored at level 1 in the default pipe stack.
at org.openstreetmap.osmosis.core.pipeline.common.PipeTasks.retrieveTask(PipeTasks.java:159)
at org.openstreetmap.osmosis.core.pipeline.common.TaskManager.getInputTask(TaskManager.java:165)
at org.openstreetmap.osmosis.core.pipeline.v0_6.SinkSourceManager.connect(SinkSourceManager.java:51)
at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.connectTasks(Pipeline.java:74)
at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.prepare(Pipeline.java:116)
at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:86)
at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:321)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:234)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
If you don’t use --bounding-polygon
for clipping stream of osm-changes, you get updates from around the world, and no error. However, the task is to store only changes for a certain area.
osmosis \
--read-replication-interval workingDirectory=$DATA_DIR/replication_in \
--wxc $DATA_DIR/osm.osc
👈 see log here
osmosis \
--read-replication-interval workingDirectory=$DATA_DIR/replication_in \
--wxc $DATA_DIR/osm.osc
Feb 26, 2023 3:50:10 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.48.3
Feb 26, 2023 3:50:10 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Feb 26, 2023 3:50:10 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Feb 26, 2023 3:50:10 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
Feb 26, 2023 3:50:11 PM org.openstreetmap.osmosis.replication.v0_6.BaseReplicationDownloader runImpl
INFO: Reading current server state. [ReplicationState(timestamp=Sun Feb 26 15:49:08 UTC 2023, sequenceNumber=5465506)]
Feb 26, 2023 3:50:12 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline complete.
Feb 26, 2023 3:50:12 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Total execution time: 1861 milliseconds.
Are there any specific things that aren’t in the documentation about how to force osmosis to truncate the stream of osm-changes by using --bounding-polygon?
P.S.
As an interim solution, I’m currently using osmconvert
to trim the change stream.
For example, like this:
osmosis \
--read-replication-interval workingDirectory=$DATA_DIR/replication_in \
--wxc - | \
osmconvert - -B=$DATA_DIR/clip.poly --out-osc > $DATA_DIR/osct.osc && \
osmosis \
--rxc $DATA_DIR/osct.osc \
--wxc $DATA_DIR/osmz.osc