Commit 8f04c1cd authored by laurent doreille's avatar laurent doreille Committed by Sp3r4z
Browse files

et une frontiere une

parent 9ff75e57
......@@ -11,12 +11,22 @@ getPostcodeByName = name => {
})
},
createCircle = (lat,lng) => {
if(circle != null) circle.removeFrom(theMap)
let turfCircle = turf.circle([lng, lat], 100),
circle = turf.intersect(turfCircle, metropole) // can't be done, turf need v6
if( circle !== undefined && circle != null ) circle.removeFrom(theMap)
circle.addTo(theMap)
let turfCircle = turf.circle([lng, lat], 100);
// on sait que notre cercle turf est un polygon
// on sait que la metropole est un multipolygon
// on parcours les elements en les transformant en polygon
// et intersect
let metropoleElements = metropole.geometry.coordinates;
metropoleElements.forEach( (e,index) => {
var feat={'type':'Polygon','coordinates':metropoleElements[index]};
circle = turf.intersect(turfCircle, feat);
L.geoJSON(circle).addTo(theMap)
});
},
createMarker = (lat,lng) => {
return L.marker([lat, lng])
......@@ -60,15 +70,15 @@ fetch('geojson/metropole.geojson')
.then(response => response.json())
.then(datas => {
metropole = datas
L.geoJSON(metropole).addTo(theMap)
//L.geoJSON(metropole).addTo(theMap)
})
/*
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>',
maxZoom: 19,
}).addTo(theMap)
*/
L.Control.geocoder({
defaultMarkGeocode: false
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment