Skip to content
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

More robust support for feature.id #720

Merged
merged 6 commits into from
Jun 11, 2019
Merged

More robust support for feature.id #720

merged 6 commits into from
Jun 11, 2019

Conversation

bcamper
Copy link
Member

@bcamper bcamper commented Jun 9, 2019

All data formats supported by Tangram have a feature.id property (at the top feature level, outside feature.properties; some data sets may separately include an id or similar property within feature.properties), but we haven't had full support for it. This PR fixes that:

  • Ensures feature.id persists wherever features are internally copied/synthesized/etc. internally
  • Provides access to feature.id in user-authored JS scene functions with a new $id variable
  • Includes feature.id in feature object results returned from scene.queryFeatures()
  • Includes feature.id in the default uniqueness check for scene.queryFeatures(), with $id syntax used if specifying a list of properties to uniqueify on, e.g.:
    • For default scene.queryFeatures({ unique: true }), feature.id will be included in uniqueness check
    • For explicit unique property list scene.queryFeatures({ unique: ['$id'] }), feature.id can be included in uniqueness check with $id (un-prefixed names refer to feature.properties)

@bcamper bcamper added this to the v0.19.0 milestone Jun 9, 2019
@bcamper
Copy link
Member Author

bcamper commented Jun 9, 2019

@matteblair @tallytalwar I think the most salient thing here for ES is addition of $id syntax for JS functions (which was the most natural way I could imagine access for this, by extending the $ syntax for other variables outside of feature.properties).

@bcamper
Copy link
Member Author

bcamper commented Jun 11, 2019

Discussed in chat.

Updated to ensure $id works in filter objects (e.g. filter: { $id: 5 }) in addition to filter JS functions (filter: function(){ return $id == 5; }).

@bcamper bcamper merged commit ffa1172 into master Jun 11, 2019
@bcamper bcamper deleted the feature-id-accessor branch June 11, 2019 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant