MapboxSource is a component that allows you to add and manage data sources in your Mapbox map. It supports various source types including GeoJSON, Vector Tiles, Raster Tiles, and Image sources. The component handles source lifecycle management, including adding, updating, and removing sources.
<template>
<MapboxMap>
<MapboxSource
id="my-source"
:source="{
type: 'geojson',
data: {
type: 'FeatureCollection',
features: [...]
}
}"
/>
</MapboxMap>
</template>
| Prop | Default | Type |
|---|---|---|
id* | stringUnique identifier for the source | |
source* | SourceSpecificationSource specification object that defines the source type and data | |
options | GeoJSONSourceSpecificationAdditional options for GeoJSON sources |
The component supports the following source types:
{
type: 'geojson',
data: {
type: 'FeatureCollection',
features: [...]
}
}
{
type: 'vector',
url: 'mapbox://mapbox.mapbox-streets-v8'
}
{
type: 'raster',
url: 'mapbox://mapbox.satellite'
}
{
type: 'image',
url: 'https://example.com/image.png',
coordinates: [
[-76.54, 39.18],
[-76.52, 39.18],
[-76.52, 39.17],
[-76.54, 39.17]
]
}