Validate GeoJSON
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: 0.39.1
Due to some sloppy code I passed some pretty defective GeoJSON, like:
```
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"coordinates": [145, -37]
}
]
}
```
Instead of raising a " Error: Input data is not a valid GeoJSON object." error, this error is thrown:
```
Error: TypeError: Cannot read property 'type' of undefined
at Actor.receive (mapbox-gl.js:397)
at e.whenMapLoaded ((index):58)
at e.Evented.fire (mapbox-gl.js:417)
at e._render (mapbox-gl.js:391)
```
Adding at least a `"geometry"` attribute to the `Feature` object triggers the correct error.
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
Start by reproducing the malformed FeatureCollection in the issue and follow the reported stack trace to Actor.receive in the mapbox-gl.js bundle. Confirm that a Feature missing geometry produces the intended invalid GeoJSON error rather than a TypeError; the issue is done when this case is handled consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100