GeoJSON
Eine Snippet-Sammlung für GeoJSON.
Links:
- RFC 7946 – The GeoJSON Format - Offizielle Spec
- awesome-geojson - Eine Linksammlung von Tools, Doku, Bibliotheken, Daten rund um GeoJSON
- geojson.io - Web-basierter GeoJSON-Viewer
- GeoJSON-Tutorial
- Mapbox-GL-JS-Tutorial Add multiple geometries from one GeoJSON source
- Maki Icons
Data-driven styling in Mapbox GL JS
Siehe: Style lines with a data-driven property
mapboxMap.addSource('my-source-id',
{
type: 'geojson',
data: {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: { type: 'Point', coordinates: [ 11.627089, 48.183847 ] },
properties: {
'radius': 12,
'color': '#4A90E2'
}
},
{
type: 'Feature',
geometry: { type: 'Point', coordinates: [ 11.624484, 48.184934 ] },
properties: {
'radius': 6,
'color': '#880000'
}
}
]
}
}
)
mapboxMap.addLayer({
id: 'my-layer-id',
type: 'circle',
source: 'my-source-id',
paint: {
'circle-radius': ['get', 'radius'],
'circle-color': ['get', 'color'],
'circle-opacity': 1,
'circle-stroke-width': 2,
'circle-stroke-color': 'white',
'circle-pitch-scale': 'viewport',
'circle-pitch-alignment': 'map'
}
})
Hinweis:
- Der Ausdruck
['get', 'radius']
ist eine get expression.