Support nested objects and arrays for GeoJSON features in query*Features
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**v0.16.0**:
Hi! This is my first issue report, so I hope I get it right.
Basically I'm trying to use the function queryRenderedFeatures to get the underlying data in JSON format to present on a popup. This works for the higher level of the JSON data (I can show the data on the popup), but fails to get the more deeply nested data - a console.log suggests that the objects have been converted into a string instead.
Here's the link to the issue as demonstrated using the example on "popup on hover": [jsbin](https://jsbin.com/leroki/edit?html,console,output)
I've edited the data such that there is only a single marker and also added an array of objects called "list" under "properties" a la feature.properties.list. I've also changed the popup HTML to display the first element of what is supposed to be a list.
### Expected Behavior
I expect that on hover the popup should display the first object, {"id":1,"name":"A"}.
### Actual Behavior
Instead, it shows "[", which confirms that it returns a string instead of the object.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with the linked jsbin and the popup-on-hover example, starting at the queryRenderedFeatures API. Trace how feature.properties values are returned and verify that nested objects and arrays remain structured; done means the popup displays the first list object as {"id":1,"name":"A"} rather than "[".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100