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

Feature ID (type: object) not preserved on queryRenderedFeature method #3863

Closed
Jonibigoud opened this issue Dec 26, 2016 · 2 comments
Closed

Comments

@Jonibigoud
Copy link

mapbox-gl-js version: 0.29.0

Expected Behavior

Feature "id" property is preserved on geojson whose "id" is an object. (mongodb ObjectId)

Actual Behavior

When i use the queryRenderedFeature's mapbogl method on a geojson collection hosted on a mongodb database, the output shows the entire document structure but the "_id" property. The thing is that each "Feature" got his auto generated _id "objectId" from the mongodb engine.

@stackTom
Copy link

How does queryRenderedFeatures return your id? As a string? If so, you can use JSON.parse(idObject) as a workaround. In my use case, it returns arrays as a string, and I use this method to get back the objects.

@jfirebaugh
Copy link
Contributor

Thanks for the report @Jonibigoud. We have an existing issue on this -- #2716 -- so I'm going to close this as a duplicate.

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

No branches or pull requests

3 participants