-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature id should not be num but dynamic #14
Comments
Hi @felix-ht, I tried to use dynamic, but it seems mapbox-gl.js only accepts numbers. If I print the id on click, a feature with numeric id is printed, the one with id string is printed null. |
you can try this branch: https://github.com/andrea689/mapbox-gl-dart/tree/feature-id-as-dynamic
|
i checked and it seems that this is an upstream issue: however adding promote id to the creation of the layer allows promoting an id that is part of the feature.properties - this works with strings as well. Not strings Working with promotion So i would suggest to change id to dynamic anyhow. As this would allow to the use of promoteId to have string ids. |
promoteId seems work fine with dart as well - https://github.com/Ocell-io/mapbox-gl-dart/tree/test-promoteId - (GeoJsonSource doesn’t contain the promoteId api) |
@felix-ht I also added |
Thanks for adding this 👍 |
Feature ids are currently of type num
num get id => jsObject.id;
It would be great if we could change that to be dynamic. As this aligns it with how id is defined for IOS and android.
This is how it is defined in iOS and android
https://docs.mapbox.com/ios/maps/api/6.3.0/Protocols/MGLFeature.html#/c:objc(pl)MGLFeature(py)identifier
geojson-types also specifies it as
id?: number | string
https://github.com/mapbox/geojson-types/blob/master/index.js
The text was updated successfully, but these errors were encountered: