Skip to content

Commit

Permalink
Add Zurich boundary layer to the map
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo Hofer committed Jan 11, 2024
1 parent fae2467 commit 8f9a0b0
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { useEffect } from 'react';
import MapLibreGL from 'maplibre-gl';
import 'maplibre-gl/dist/maplibre-gl.css';



function Map() {
useEffect(() => {
const map = new MapLibreGL.Map({
Expand All @@ -18,8 +16,27 @@ function Map() {
new MapLibreGL.Marker()
.setLngLat([8.5428242, 47.3669311])
.addTo(map);

// load the boarder of burgdorf from the overpass api
map.addSource('zurich', {
type: 'geojson',
data: 'https://overpass-api.de/api/interpreter?data=[out:json];area[name=%22Z%C3%BCrich%22];(relation(area)[type=boundary][boundary=administrative];);out%20geom;'
});


map.addLayer({
id: 'zurich-layer',
type: 'fill',
source: 'zurich',
layout: {},
paint: {
'fill-color': '#ff0000',
'fill-opacity': 0.5
}
});
});
}, []);

return <div id="map" style={{ width: '100%', height: '100vh' }} />;
}

Expand Down

0 comments on commit 8f9a0b0

Please sign in to comment.