-
Notifications
You must be signed in to change notification settings - Fork 300
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
Add option to Generate IDs for input features #97
Comments
Let's do |
👍 I tried to implement this when working on #94, but found that collisions would be likely with index of points in the input and the the encoded cluster id The
|
@asheemmamoowala so let me get this straight, we could simply use the normal calculation for cluster id + |
also are we against creating a function for generating near-random integers? I was using this fn to place 100k features on my map originally:
|
That was the proposal. This has a possibility of conflicting with existing ids in a large GeoJSON file. There is not a good suggestion so far of how to guarantee that cluster ids do not conflict with geojson feature ids if already present in the data.
Yes. Using random values for ids means that the same geojson will produce different results on different runs, preventing persisting ids between sessions, For example, consistent id generation will allow maintaining the id of "select" features across calls to |
Ok that makes a lot of sense.
I see. Are you worried that the feature.id will be set by the user incoming to mapbox gl, or that the id will be set via the If it is |
Yes I am worried about a GeoJSON source with existing feature ids conflicting with the generated ids for clusters.
If the input data already has feature Ids, I don't think that we should be changing those. Developers should be able to rely on their individual feature nodes coming through this library un-changed. |
#94 implements index-based ids for the returned cluster nodes. Some GeoJSON input may not have feature ids, or may use string feature ids which do not work with
geojson-vt
.Proposal
generateLeafIds
: enables generation of ids on the leaf nodes, ensuring uniqueness across leaf nodes and cluster nodes. Overwrites any existingid
values.Pros: Simple and efficient solution to create GeoJSON and VT spec compliant
id
attributes for all nodes.Cons:
id
value for a feature can change between different invocations of the API, and depends on the input GeoJSONfeatures
.The text was updated successfully, but these errors were encountered: