Hi,

On 04.07.2012 19:42, WanMil wrote:
I have another question regarding osmconvert / osmosis PBF reading.

osmosis is not able to read pbf files that have no author information
(removed with osmconvert africa.osm.pbf --drop-author
-o=africa_noauthor.osm.pbf)

When reading the africa_noauthor.osm.pbf file with osmosis an
IndexOutOfBoundsException is thrown. Is the author information mandatory
for osmosis? Is it possible to change that?
well... Osmosis doesn't care much about authors and it sure does not require them AFAIK. However, this is irrelevant, as the exception is not thrown by Osmosis. It is thrown by the PBF deserialization library, which is not even part of Osmosis.

Given the stack trace that you kindly provided:

java.lang.IndexOutOfBoundsException: Index: 0
        at java.util.Collections$EmptyList.get(Unknown Source)
        at crosby.binary.Osmformat$DenseInfo.getUid(Osmformat.java:3026)
[...]

you can see that the exception is thrown in crosby.binary.Osmformat. This class is autogenerated by the protobuf compiler from the format description (namely osmformat.proto). The exception is thrown when parsing a DenseInfo message. This is defined as follows:

message DenseInfo {
   repeated int32 version = 1 [packed = true];
   repeated sint64 timestamp = 2 [packed = true]; // DELTA coded
   repeated sint64 changeset = 3 [packed = true]; // DELTA coded
   repeated sint32 uid = 4 [packed = true]; // DELTA coded
repeated sint32 user_sid = 5 [packed = true]; // String IDs for usernames. DELTA coded
   repeated bool visible = 6 [packed = true];
}

The user id is indeed optional ("repeated" means zero or more times), so there _can_ be valid OSM PBFs that have no author information - if they are properly encoded.

Given that the exception is thrown in generated code which deals with pure deserialization, I strongly suspect that your input PBF is somehow broken. Which means this --drop-author business in osmconvert is suspicious. Which means that you should talk to Marqqs about the problem :)

BTW, did you try feeding this noauthor PBF into osmium? If you did, what was the result?

In the meantime, may I suggest a workaround for the task at hand:

osmosis --read-pbf africa.osm.pbf --write-pbf africa-noauthor.osm.pbf omitMetadata=true

drops the author just as well (along with other non-essential stuff) :) Or is there something wrong with that?

Greetings from Stuttgart
Igor

_______________________________________________
osmosis-dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/osmosis-dev

Reply via email to