mapbox / mapbox/shp-write

[BUG] MultiLineString features are consolidated into a single feature

Open
#127 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
321
Forks
195
PR merge metrics
No merged PRs in 30d

Description

If you pass .zip() an array of multilinestring features, the lines are consolidated into a single feature.

For the features below, I would expect a shapefile with two independently selectable features. However, they are unified into a single feature. I haven't seen this same issue when working with points

```
const features = [
{type:"Feature",geometry:{type:"MultiLineString",coordinates:[[[-118.429159,33.997878],[-118.429407,33.998196]],[[-118.429797,33.998696],[-118.429904,33.998833]],[[-118.428464,33.996969],[-118.428366,33.99686],[-118.42825,33.99675],[-118.428044,33.99658]],[[-118.428464,33.996969],[-118.428583,33.997131],[-118.428833,33.997472]]]}},
{type:"Feature",geometry:{type:"MultiLineString",coordinates:[[[-118.403108,34.01443],[-118.403007,34.014388]]]}}
]

const dataforZip = {
type: "FeatureCollection",
features: features,
options
}

const zipData = await shpwrite.zip(
dataforZip,
options
);
```

The output geometry from the above is:

`
{"type":"MultiLineString","coordinates":[[[-118.429159,33.997878],[-118.42940700000001,33.998196]],[[-118.429797,33.99869600000001],[-118.429904,33.998833]],[[-118.42846399999999,33.996969],[-118.42836599999998,33.99686],[-118.42825000000002,33.996750000000006],[-118.42804400000001,33.99658]],[[-118.42846399999999,33.996969],[-118.428583,33.997131],[-118.428833,33.997472]],[[-118.40310800000002,34.01443],[-118.403007,34.014388]]]}`

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 reproducing the issue with the supplied FeatureCollection and the shpwrite.zip entry point, then trace how MultiLineString features are converted for shapefile output. Done means the two input features remain independently selectable rather than being combined into one output feature.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
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.