mapbox/mercantile

Unexpected id, bbox, and title property in feature from mercantile.feature

Closed this issue ยท 1 comments

Helloo ๐Ÿ‘‹

when I use

mercantile.feature(tile, props={"n"=2}, precision=6)

to get a tile's feature I expect it to return the tile's bounding box as a GeoJSON polygon (bounding box) feature.

The returned dict looks like this

{'type': 'Feature', 'bbox': [-7.382812, 58.077876, -7.03125, 58.263287], 'id': 'Tile(x=491, y=307, z=10)', 'geometry': {'type': 'Polygon', 'coordinates': [[[-7.382812, 58.077876], [-7.382812, 58.263287], [-7.03125, 58.263287], [-7.03125, 58.077876], [-7.382812, 58.077876]]]}, 'properties': {'title': 'XYZ tile Tile(x=491, y=307, z=10)', 'n': 2}}

why is there a bbox and an id property on the feature? And then there is an additional title property in the geometry properties, too.

What's the reason behind this? The bbox is already encoded in the polygon coordinates, the id is just a string and I'm not sure if this is GeoJSON conforming, and the title property in the coordinates is also unexpected.

I can work around this easily, just wanted to ask what the thought process behind this is / was and if we should change it to just return the GeoJSON feature as documented.

@daniel-j-h I wanted id, bbox, and a title for an application I developed years ago. The title, for one, helps the mercantile tile parameters surface in geojson.io. We could make them optional, but they are conforming and shouldn't cause any problems other than some inflation of the output.