Style spec: Pull more than one data source into a layer
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Style layers can currently only specify a single data layer. With data driven styling, we're looking at rendering the same data with fewer style layers. I propose adding support for pulling multiple data sources into one style layer. In a data source, the split between putting features into separate data layers vs. putting them in the same data layer and using tags to filter/separate them is somewhat arbitrary. Adding support for multiple data layers also means that they could stem from different sources, e.g. a regular tileset and a GeoJSON file, or runtime annotations.
In terms of style spec change, we could make the `source` field an array that allows specifying multiple data source/layer combinations:
```json
{
"id": "landcover",
"type": "fill",
"source": [
["streets", "landcover"],
["geojson", "glaciers"]
],
...
}
```
Alternatively, we could use a different attribute like `data` and move `source`, `source-layer`, and `filter` to that:
```json
{
"id": "landcover",
"type": "fill",
"data": [
{
"source": "composite",
"source-layer": "landcover",
"filter": [
"all",
["in", "class", "crop", "grass", "scrub", "wood", "snow"]
]
},
{
"source": "glaciers.geojson"
}
],
...
}
```
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 reviewing the style-layer `source`, `source-layer`, and `filter` fields and the two proposed JSON shapes in the issue. Resolve which representation and compatibility behavior should be adopted; done means the style specification supports multiple data sources in one layer with the chosen format clearly defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100