[osmosis-dev] Problem creating pbf data with osmosis 0.39
Igor Podolskiy
igor.podolskiy at vwi-stuttgart.de
Fri Sep 23 17:37:46 BST 2011
Hi Michael,
> One question, however: if I am understanding this correctly, the
> problem was with reading pbf files, not with creating them. This would
> mean that also pbf files created with osmosis 0.39 were valid and did
> not really contain an empty bounding box?
>
> I am asking because the mkgmap splitter still sees such an empty
> bounding box even when reading pbf data created with the latest osmosis
> from snapshot. Are the changes you did to osmosis to be applied to the
> splitter, too?
you got it right, the PBF reader produced a spurious empty bounding box
while reading a PBF file without a bounding box set. This is now fixed
in Osmosis.
I must admit that I don't know anything about the mkgmap splitter (I
barely knew that it even exists ;)). I just looked at the sources and it
very well might be that the splitter's BinaryMapParser has the same bug.
The function parse(Osmformat.Headerblock) there [1] looks suspiciously
similar to what Osmosis did before the fix in OsmosisBinaryParser :)
IMHO there should be a check for hasBbox(), too... but as I said, I
might be looking at the wrong sources for all I know. Any mkgmap people
here? :)
I can think of another reason why you might see those empty bounding
boxes in your data, though. If you have a file no-bb.osm.pbf without a
bounding box set and a following trivial osmosis pipeline:
osmosis --read-pbf no-bb.osm.pbf --write-pbf x.osm.pbf
then the following happens: the PBF reader reads the input file, emits a
spurious bounding box and passes it down the pipeline. The PBF writer
gets the bounding box from the pipeline and dutifully writes it into
x.osm.pbf since it doesn't know that the bounding box has been
spuriously generated by the PBF reader. Now you have an x.osm.pbf with a
proper bounding box explicitly set to 0,0,0,0. This bbox will of course
pop up in every PBF reader since it is actually written to the file.
Is there any chance that the files in question have been generated by an
Osmosis pipeline which involves both reading and writing a pbf file
without a bbox? :)
If so, right now you can convert the files to XML, delete the bbox
manually and reconvert them to PBF if it's somehow feasible. If you can
wait some time, I'm currently working on a set of Osmosis tasks that let
you manipulate the bounding box in the stream - that would be more
elegant than editing those files by hand.
Hope that helps
Igor
[1]
http://svn.mkgmap.org.uk/splitter/trunk/src/uk/me/parabola/splitter/BinaryMapParser.java
More information about the osmosis-dev
mailing list