mapbox / supermercado

Supercharger for mercantile
MIT License
127 stars 21 forks source link

The function find_extrema(features) didn’t support MultiPolygon #28

Closed lytk01 closed 4 years ago

lytk01 commented 5 years ago

https://github.com/mapbox/supermercado/blob/a3f3e4b0a5b4694aabc6245f90bd8a93db8c90a4/supermercado/burntiles.py#L17

The function find_extrema(features) didn’t support MultiPolygon

pratikyadav commented 4 years ago

find_extrema is now supporting MultiPolygon as polygons

https://github.com/mapbox/supermercado/blob/master/supermercado/burntiles.py#L29-L50

multi3 = {"features": [{"geometry": {"coordinates": [[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]], "type": "MultiPolygon"}, "id": "0", "properties": {}, "type": "Feature"}], "type": "FeatureCollection"}

polygons = multi3['features']
features = [f for f in filter_features(polygons)]

print(find_extrema(features))

> (100.0000000001, 1e-10, 102.9999999999, 2.9999999999)