topobyte / osm4j-pbf

PBF input/output for osm4j
17 stars 7 forks source link

Handle missing coordinates #5

Closed mojodna closed 6 years ago

mojodna commented 6 years ago

Coordinates may be missing as a result of redactions or for other reasons. When absent, unscaled coordinates will be Integer.MAX_VALUE.

Rather than storing them as 214.7483647 (scaled Integer.MAX_VALUE), they should be represented as Double.NaN.

To create data-without-metadata.pbf containing nodes with empty coordinates:

osmium cat -o data.xml data-without-metadata.pbf
# edit data.xml to remove lat/lon values from some node(s)
osmium cat --overwrite -o data-without-metadata.pbf data.xml

To avoid creating DenseNodes, run:

osmium cat --overwrite -o data-without-metadata.pbf data.xml -f pbf,pbf_dense_nodes=false
sebkur commented 6 years ago

Looks good, thanks! I'd like to add some basic testing to the pbf module before integrating this. I started working on this now, but ran into problems with the metadata timestamps being different with XML and PBF: https://github.com/topobyte/osm4j-pbf/blob/909bb84ff42845e4a56b29c832076649eec72497/core/src/test/java/de/topobyte/osm4j/pbf/TestValidateWithMetadata.java#L51 I think I'll resolve this in the upcoming week and then be able to integrate your changes and upload a new version of the library to the Maven repository.

sebkur commented 6 years ago

I just released version 0.1.1: http://mvn.topobyte.de/de/topobyte/osm4j-pbf/0.1.1/ which includes these changes.

mojodna commented 6 years ago

Fantastic, thanks!!