tilezen / mapbox-vector-tile

Python package for encoding & decoding Mapbox Vector Tiles
MIT License
240 stars 47 forks source link

Outer rings sometimes dropped #87

Open nvkelso opened 7 years ago

nvkelso commented 7 years ago

Outside of Bremen, Germany some of the larger meadow landuse polygons are broken / missing large pieces in MVT compared to the same tile in TopoJSON. (I vaguely remember the same thing happening to some of the plodder "wetland/ farmland" landuse outside of Amsterdam, too?)

To replicate this problem "Open" the following GIST into Tangram Play: https://api.github.com/gists/35bc3a9b8adb925dd7e4e8c64f60c506

And zoom the map to (update the address bar URL): 10.8042/53.1278/8.6035

Changing the source from MVT:

    osm:
        type: MVT
        url: https://tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.mvt

to GeoJSON:

    osm:
        type: GeoJSON
        url: https://tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.json

Shows the raw output of tile build is okay, but the later transformation encoding the features to MVT is borked.

Bad MVT encoding:

screen shot 2017-01-12 at 11 49 41

Good source GeoJSON tiles:

screen shot 2017-01-12 at 11 49 33

/cc @hjanetzek

zerebubuth commented 7 years ago

It's not just some of the larger meadow polygons - many smaller polygons of meadow and the two other kinds of green (forest and wood?) are missing too. The image below shows the difference between the two images:

image

:confounded:

adodo1 commented 6 years ago

see my issues #103

because the polygon part

to solve like this

for example:

a polygon in geojson >>

{
    "type": "Feature",
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [0, 0],
                [10, 0],
                [0, 10],
                [0, 0]
            ],
            [
                [15, 0],
                [15, 15],
                [30, 0],
                [15, 0]
            ]
        ]
    }
}

you must make it to MultiPolygon like this

{
    "type": "Feature",
    "geometry": {
        "type": "MultiPolygon",
        "coordinates": [
            [[
                [0, 0],
                [10, 0],
                [0, 10],
                [0, 0]
            ]],
            [[
                [15, 0],
                [15, 15],
                [30, 0],
                [15, 0]
            ]]
        ]
    }
}