mapbox / mapbox/vt-pbf

Incorrect encoding of LineStrings when using fromGeojsonVt

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

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
206
Forks
38
PR merge metrics
No merged PRs in 30d

Description

When using geojsonvt to create tilesets I found that some layers were incorrectly rendered.
Examining what happened I found that the geometry that comes from _geojsonvt_ contains all the LineString geometry on a single array: instead of having [[x0, y0], [x1, y1], ..., [xN, yN]] it's all flattened as [x0, y0, x1, y1, ... xN, yN].
When using _fromGeojsonVT_ this is not correctly interpreted in _FeatureWrapper::loadGeometry_ so the geometry contains an array of Points with undefined coordinates.

Should something be implemented in _vt-pbf::fromGeojsonVt_ to correctly interpret this case?
I was thinking about modifying GeoJSONWrapper to also store the feature type so when geometry is loaded from a LineString it checks wether the geometry comes as a single array or an array of arrays.

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 at FeatureWrapper::loadGeometry and inspect how GeoJSONWrapper represents LineString geometry from geojsonvt. Reproduce the issue with a flattened LineString, then ensure fromGeojsonVt produces points with valid coordinates for both flattened and nested geometry forms.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.