我是Leaflet的新成员,我试图在世界地图中显示与不同国家/地区相关联的一些值。 Leaflet仅显示空白地图。
我使用以下代码:
// load GeoJSON from an external file
$.getJSON("convertcsv.geojson", function(data) {
// add GeoJSON layer to the map once the file is loaded
L.geoJson(data).addTo(map);
});
包含该信息的geojson文件具有以下结构:
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": {}
},
"properties": {
"FIELD1": null,
"FIELD2": "Country",
"FIELD3": "Year",
"FIELD4": "Gender",
"FIELD7": "Longitude"
}
}, {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [33.7680065, 14.63608]
},
"properties": {
"FIELD1": 0,
"FIELD2": "Afghanistan",
"FIELD3": "1993",
"FIELD4": "Female",
"FIELD7": "66.2385139"
}
}, {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [33.7680065, 28.65191]
},
"properties": {
"FIELD1": 1,
"FIELD2": "Afghanistan",
"FIELD3": "1993",
"FIELD4": "All genders",
"FIELD7": "66.2385139"
}
},