DenysMoskalenko/vt2pbf

No feature_id on the pbf tile

Closed this issue · 5 comments

Current implementation doesn't allow pass the feature_id as parameter from tile.py line 24.

Function add_feature function support the feature_id -> def add_feature(self, feature_info: dict, feature_id: int = None)

any idea?

Hello)
Could you please explain in which particular case you need a function id?

To build an interactive hover effects we need to a feature state (FT). FT relies on each feature having a numeric id.

https://docs.mapbox.com/help/tutorials/create-interactive-hover-effects-with-mapbox-gl-js/

You need to assume that each feature in the vector_tile will have an id. Id is not mandatory to build the pbf

Got it)
I will figure it out, update library and mention you here soon

In fact, the feature_id parameter in the Layer class was a blueprint for the future. The idea was that you could use all classes and build tiles in your own way, not just with the main vt2pbf function.
But now I see that supporting this functionality requires a lot of refactoring. I hope to be able to do this in the future if the library is used more often.

As a hotfix solution I have added some logic which should help you with your requirements.
Check out this PR please: #7

Thanks for your support!