tilezen/mapbox-vector-tile

Raise an exception on geometries of GeometryCollection type

Closed this issue · 1 comments

ptpt commented

Would be good if it could raise an exception to tell users that it doesn't support encoding GeometryCollection.

Otherwise protobuf will complain like this

collection = shapely.wkt.loads('GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (4095 3664), LINESTRING (2889 0, 2889 0)), POINT (4095 3664), LINESTRING (2889 0, 2912 
158, 3757 1700, 3732 1999, 4095 3277))')
mvt.encode({'name': 'streets', 'features': [{'geometry': collection}]})

# TypeError: None has type <type 'NoneType'>, but expected one of: (<type 'int'>, <type 'long'>)

which doesn't make sense

Thanks for the report! This should be fixed on master now.