1
나는 약간의 오류가있어서 나는 해석 할 수 없다. 네가 나를 도울 수 있기를 바랍니다. leaftlet의 속성에 따라 geojson 폴리곤 레이어의 스타일을 지정하려고하는데이 오류가 발생합니다.속성에 따른 전단지에 GeoJson 스타일 지정
Object {type : "FeatureCollection", crs : Object, features : Array [49]}.
function getVictimsColor(totalone){
if (totalone > 1000){
return 'red';
}else if(totalone > 500){
return 'orange'
}else if(totalone > 250){
return 'blue'
}else if(totalone > 100){
return 'white'
}else if(totalone > 50){
return 'green'
}else if(totalone > 10){
return 'black'
}else if(totalone > 5){
return 'yellow'
}
}
function style(feature) {
return {
weight: 2,
opacity: 1,
color: 'white',
dashArray: '3',
fillOpacity: 0.7,
fillColor: getVictimsColor(feature.properties.totalone)
};
}
var map = L.map('map').setView([47.9630, 24.1875], 4);
var layer = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
attribution: '© <a href="http://openstreetmap.org">OpenStreetMap</a>
layer.addTo(map);
function addDataToMap(data, map) {
var dataLayer = L.geoJson(
data,
{style:getVictimsColor}
);
dataLayer.addTo(map);
}
$.getJSON("Europe_victims.geojson", function(data) {
console.log(data)
addDataToMap(data, map);
});
의견을 보내 주셔서 감사합니다. console.log를 가져 왔는데 오류가 사라졌지만 여전히 레이어 스타일이 아닙니다 ... –