Examples
GeoJSON Layer
Render GeoJSON polygons and lines on the map.
Installation
$ npx shadcn-vue@latest add https://mapcn-vue.geoql.in/r/map-layersUsage
<script setup lang="ts">
import { VMap, VLayerMaplibreGeojson, VControlNavigation } from '@geoql/v-maplibre';
const mapOptions = {
style: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json',
center: [-74.006, 40.7128],
zoom: 11,
};
const geojsonData = { type: 'FeatureCollection', features: [...] };
const source = { type: 'geojson', data: geojsonData };
const fillLayer = {
id: 'geojson-fill',
type: 'fill',
source: 'geojson-source',
paint: { 'fill-color': '#10b981', 'fill-opacity': 0.5 },
};
</script>
<template>
<VMap :options="mapOptions" class="h-125 w-full">
<VControlNavigation position="top-right" />
<VLayerMaplibreGeojson
source-id="geojson-source"
layer-id="geojson-fill"
:source="source"
:layer="fillLayer"
/>
</VMap>
</template> Components 3
<VMap />@geoql/v-maplibre<VLayerMaplibreGeojson />@geoql/v-maplibre<VControlNavigation />@geoql/v-maplibre