mapbox / mapbox/wellknown

The parser is forgiving unbalanced parens, missing commas, and invalid object names

Open
#35 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
281
Forks
47
PR merge metrics
No merged PRs in 30d

Description

Those three strings, when parsed, result in a valid GeoJSON output:

```
MULTIPOLYGON(40 40,20 45,45 30,40 40)),((20 35,10 30,10 10,30 5,45 20,20 35)))
MULTIPOLYGON(((40 40,20 45,45 30,40 40))((20 35,10 30,10 10,30 5,45 20,20 35)))
MULTIPOLYGONN(((40 40,20 45,45 30,40 40)),((20 35,10 30,10 10,30 5,45 20,20 35)))
```

I'd expect a `null` instead.

Otherwise, in our use case, the invalid WKT passes the browser-side validation and makes it through to a Postgres/PostGIS DB. PostGIS then rejects anything like the three examples above.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the three malformed WKT strings through the parser entry point and checking the generated GeoJSON. Add regression coverage showing that unbalanced parentheses, missing commas, and the invalid object name produce null, then verify valid WKT parsing remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.