GeoJSON

Eine Snippet-Sammlung für GeoJSON.

Links:

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: