Open hyperknot opened 6 years ago
It should be noted that GeoJSON suggestions both numbers and strings for its feature ids. While Draw can move to using random numbers for its auto created ids, we need to support string ids as well. I guess we could create a string to number lib to help with that.
I believe https://github.com/mapbox/mapbox-gl-js/issues/2716 is about solving strings.
mapbox-gl-js version: 0.45.0 mapbox-gl-draw version: 1.0.9
mapbox-gl only supports uints for feature ids. If a feature id is not an integer it'll be silently removed from queryRenderedFeatures's results.
mapbox-gl-draw is using strings for feature ids, via the
hat()
library/function.This means that features where the ids were generated via draw will have missing ids in mapbox-gl / queryRenderedFeatures.
I believe probably
hat()
should be changed to some kind of random integer instead.The other issue is that there are actually two locations for ids in draw.
feature.id
feature.properties.id
It's all internal functions where id is used, but maybe draw should only use a root level, integer id.