mapbox / geobuf

A compact binary encoding for geographic data.
ISC License
968 stars 84 forks source link

json2geobuf doesn't encode altitude properly if a coordinate is missing altitude value #78

Open stonetip opened 7 years ago

stonetip commented 7 years ago

Given a MULTIPOINT set like:

{
    "type": "MultiPoint",
    "coordinates": [
        [-112.021, 46.58, 1400],
        [-112.045, 46.6],
        [-112.0331, 46.5901, 1342]
    ]
}

The resulting set, after being converted to a PBF using json2geobuf and decoded with geobuf2json (or other decoders) shows the same (first occurring) altitude for all points in the set:

{
    "type": "MultiPoint",
    "coordinates": [
        [-112.021, 46.58, 1400],
        [-112.045, 46.6, 1400],
        [-112.0331, 46.5901, 1400]
    ]
}

The issue does not occur if the point in the sample set is given an altitude of 0 or another value.

mourner commented 7 years ago

Looks like a bug. Related: #30. Currently Geobuf doesn't support missing altitude but at least it should fall back with a 0 value, not copy over the same one from the first coordinate.