[osmosis-dev] Example code for PBF reading
Brett Henderson
brett at bretth.com
Tue Apr 15 11:57:34 UTC 2014
On 19 March 2014 06:44, Peter K <peathal at yahoo.de> wrote:
> Osmosis just uses this library, right?
>
> I mean, it is a nicely packaged version of LGPLed OSM-binary:
> https://github.com/openstreetmap/osmosis/tree/master/osmosis-osm-binary
>
> Use it in maven via:
> <dependency>
> <groupId>org.openstreetmap.osmosis</groupId>
> <artifactId>osmosis-osm-binary</artifactId>
> <version>0.43.1</version>
> </dependency>
>
> Yes, Osmosis uses that. But there's a little bit more to the story which
might be useful.
The osmosis-osm-binary project contains two pieces of code:
- Auto-generated data model classes created by the protobuf protoc
compiler.
- Scott's common decoding logic that he designed to be shared by other
projects outside of Osmosis.
Osmosis itself has two separate PBF decoders, one in its osmosis-pbf
project (--read-pbf task) and one in its osmosis-pbf2 project
(--read-pbf-fast task). The osmosis-pbf project is Scott Crosby's original
implementation, and the osmosis-pbf2 project is my re-write which supports
decoding blocks using multiple threads to improve performance.
The osmosis-pbf project utilises all of the osmosis-osm-binary project and
only adds the Osmosis task code on top. The osmosis-pbf2 project only
utilises the auto-generated protobuf classes and is an end-to-end decoding
implementation.
Finally, the osmosis-osm-binary project is not exactly Scott's original
code. The original code is at https://github.com/scrosby/OSM-binary. The
Osmosis version is mostly identical but modifies the package names to fit
within the osmosis namespace and avoid any conflicts with other builds of
the same code. I did this so that I could publish to Maven Central without
fear of conflicts.
In summary, you have the choice of two independent implementations of a PBF
decoder, and both are available via Maven Central. The osmosis-pbf2
implementation is more Osmosis specific, however it should be possible to
invoke the PbfReader class outside of the Osmosis pipeline as it performs
all of its thread management internally.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osmosis-dev/attachments/20140415/6df410a8/attachment.html>
More information about the osmosis-dev
mailing list