WebRAVE Symbology JSON id Values #109
-
Moved from: https://github.com/Riverscapes/rs-web-monorepo/issues/123
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@lauren-herbine It's not so much how JSON works. It's more how MapBox works. Mapbox is ensuring uniqueness by adding hash characters after the layer and source names. We do require both "id" and "source-layer" fields but it's only used in the validation of the symbology, not actually in rendering.
Good Example:So let's say you had a symbology file where you wanted to have a polygon with both fill and border properties It might look something like this when you export it. [
{
"id": "confinement-ratio-3oldrq",
"type": "fill",
"source": "composite",
"source-layer": "confinement_ratio-3oldrq",
"layout": {},
"paint": "blah blah blah whatever mapbox stuff here" },
{
"id": "confinement-ratio-sdf823s",
"type": "line",
"source": "composite",
"source-layer": "confinement_ratio-3oldrq",
"layout": {},
"paint": "blah blah blah whatever mapbox stuff here"
}
] You'll notice that they have different Bad ExampleNow let's see a bad example: [
{
"id": "confinement-ratio-3oldrq",
"type": "fill",
"source": "composite",
"source-layer": "confinement_ratio-3oldrq",
"layout": {},
"paint": "blah blah blah whatever mapbox stuff here" },
{
"id": "confinement-ratio-sdf823s",
"type": "line",
"source": "composite",
"source-layer": "constriction_ratio-23dfs2q",
"layout": {},
"paint": "blah blah blah whatever mapbox stuff here"
}
] Here the same sort of thing except the this is maybe more detail that you need to know just to copy and paste some JSON but I'll put it here so there's some justification for the seemingly arbitrary rules we've imposed on this very new process |
Beta Was this translation helpful? Give feedback.
@lauren-herbine It's not so much how JSON works. It's more how MapBox works. Mapbox is ensuring uniqueness by adding hash characters after the layer and source names.
We do require both "id" and "source-layer" fields but it's only used in the validation of the symbology, not actually in rendering.
id
: Basically I check thatid
exists and that's all. At render time we're going to assign a new one anyway so I don't reallly care about the values themselvessource-layer
: what I'm looking for is that there aren't any Mapbox-proprietary source layers and also that every symbology file references one (and only one) source layer.Good Example:
So let's say you had a symbology file where you wan…