Skip to content
Vue Neshan MapsDeveloper documentation

GeoJSON

Style point, line and polygon features with native source options.

1 min readVue 3 / Nuxt 4Live example included
On this pageGeoJSON
Interactive exampleMapLibre

Run on a real Neshan map

Bring a domain-allowed web key. Sample geometry; real basemap.

Allow sajadjanat.github.io. Your key stays in memory and is excluded from copied code.

GeoJSON#

GeoJSON is longitude first, including when used with the Leaflet component. The optional MapLibre geojsonLayers array controls native rendering; omit source because the component manages it. Without custom layers, the component supplies point/line/polygon styling.

ts
import type { MapLibreOverlayLayer } from 'vue-neshan-maps'

const geojson = {
  type: 'FeatureCollection' as const,
  features: [{
    type: 'Feature' as const,
    properties: { name: 'Azadi Square' },
    geometry: { type: 'Point' as const, coordinates: [51.338, 35.6997] },
  }],
}
const geojsonLayers: MapLibreOverlayLayer[] = [{
  id: 'places', type: 'circle',
  paint: { 'circle-radius': 8, 'circle-color': '#087f8c',
    'circle-stroke-color': '#ffffff', 'circle-stroke-width': 2 },
}]
vue
<NeshanMapLibre :api-key="webKey" :geojson="geojson" :geojson-layers="geojsonLayers" />

geojsonOptions contains native GeoJSON source options on MapLibre and L.GeoJSONOptions on Leaflet. See the complete GeoJSON component for a runnable starting point.

Independent community library. Map services and attribution belong to Neshan and OpenStreetMap. · Sajad Janat · MIT