Extending support for GeometryCollection to foreign members
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
## Motivation
I propose that support for GeoJSON "foreign members" found within individual geometries in a GeometryCollection be added to mapbox-gl-js - in the same way perhaps that all keys within "properties" are automatically discovered and can be filtered upon. The primary use case is mapping the geometry of objects (places, events, etc.) that change over time, typically manipulated with an html/css slider.
This request is on behalf of a small but growing community of interest in [Linked Places format (LPF)](https://github.com/LinkedPasts/linked-places-format), an extension of GeoJSON-LD. LPF is the 'standard' format used for contributions to [World Historical Gazetteer (WHG)](https://whgazetteer.org) and several projects of the [Pelagios](http://pelagios.org) group ([Recogito](http://recogito.pelagios.org), Peripleo, Peripleo-lite). It is seeing increasing use and interest in other projects and platforms around the world, including those of the British Library digital maps division.
## Design Alternatives
The alternative (status-quo) requires inserting a flattening process in populating the data source.
## Design
I am not familiar with the internals of mapbox-gl representations, therefore can't assess the potential obstacles or ramifications.
### Figure
I've pasted a slider into this WHG screen to indicate what implementation would enable. Each LineString is "valid" for a particular time period, as seen the data below.

### Concepts
Linked Places format was created to allow representing the dynamics of several attributes of places in a single record for that place--a break from the GIS model of a separate record for each state of a place (or phenomenon) over time. Many people would find that a useful option.
### Implementation
Currently, all keys in "properties" are automatically recognized and made available for filtering in a simple syntax. I imagine that scan could be replicated, looking for foreign members, either within items in a GeometryCollection if present (for this use case) or potentially for foreign members anywhere.
The complicated "when" objects in the following example could/would be replaced by simpler "min" and "max" keys as sibings of "type" and "coordinates" to avoid crawling objects.
```
{ "type": "FeatureCollection",
"features": [
{ "type" : "Feature",
"id" : "b_5063",
"properties" : {"title": "Shash"},
"geometry" : {
"type": "GeometryCollection",
"geometries": [
{"type": "LineString", "when": {"timespans": [{"end": {"latest": "0999"}, "start": {"earliest": "0900"}}]}, "certainty": "less-certain", "coordinates": [[68.48877, 41.470308], [68.834839, 41.462071], [69.120483, 41.392013], [69.44458, 41.239273], [69.603882, 41.111026], [69.730225, 40.928568]]},
{"type": "LineString", "when": {"timespans": [{"end": {"latest": "1800"}, "start": {"earliest": "-0330"}}]}, "certainty": "less-certain", "coordinates": [[68.197589, 41.407619], [68.6379, 41.477675], [69.098983, 41.512193], [69.516935, 41.500689], [70.034795, 41.480568], [70.362024, 41.428856], [70.677838, 41.360068]]},
{"type": "LineString", "when": {"timespans": [{"end": {"latest": "1050"}, "start": {"earliest": "1000"}}]}, "certainty": "less-certain", "coordinates": [[68.400879, 41.635812], [69.32373, 41.140996], [70.268555, 40.759089]]}
]
}
}
]
}
```
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
No source files or tests are named. Start by tracing how mapbox-gl-js discovers keys in Feature properties, exposes them to the filtering syntax, and handles GeometryCollection members; done means a clearly scoped, tested approach for foreign members within individual geometries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100