I am using Leaflet.js to draw circles on a map from Mapbox. It works like this:
$.each(json_map_data.elements, function(index, element) { console.log(element); //console.log('ITERATING OVER JSON MAP DATA'); //console.log(element.tags.amenity + ' color: ' + AMINITIES_TO_COLORS[element.tags.amenity]); if(element.hasOwnProperty('tags')) { if(element.tags.hasOwnProperty('name')) { //console.log('BEFORE IF'); //console.log('TAG.AMENITY = ' + element.tags.amenity); if(AMINITIES.has(element.tags.amenity)) { //self defined has method for arrays console.log('IN IF'); L.circle([element.lat, element.lon], 1) .bindPopup(element.tags.name) .setStyle({ stroke: false, fill: true, fillColor: AMINITIES_TO_COLORS[element.tags.amenity], fillOpacity: 0.01 * AMINITIES_TO_IMPORTANCES[element.tags.amenity] }) .addTo(AMINITIES_TO_LAYERS[element.tags.amenity]) .setRadius(AMENITIES_TO_RADIUS[element.tags.amenity]) // 500m } } } }); However, I noticed, that there is a colored polygon on my map. I only want there to be circles, because I only want to display "influence areas" and not the amenities themselves. How can I achieve this?
أكثر...
$.each(json_map_data.elements, function(index, element) { console.log(element); //console.log('ITERATING OVER JSON MAP DATA'); //console.log(element.tags.amenity + ' color: ' + AMINITIES_TO_COLORS[element.tags.amenity]); if(element.hasOwnProperty('tags')) { if(element.tags.hasOwnProperty('name')) { //console.log('BEFORE IF'); //console.log('TAG.AMENITY = ' + element.tags.amenity); if(AMINITIES.has(element.tags.amenity)) { //self defined has method for arrays console.log('IN IF'); L.circle([element.lat, element.lon], 1) .bindPopup(element.tags.name) .setStyle({ stroke: false, fill: true, fillColor: AMINITIES_TO_COLORS[element.tags.amenity], fillOpacity: 0.01 * AMINITIES_TO_IMPORTANCES[element.tags.amenity] }) .addTo(AMINITIES_TO_LAYERS[element.tags.amenity]) .setRadius(AMENITIES_TO_RADIUS[element.tags.amenity]) // 500m } } } }); However, I noticed, that there is a colored polygon on my map. I only want there to be circles, because I only want to display "influence areas" and not the amenities themselves. How can I achieve this?
أكثر...