我想用D3.js创建使用.geojson文件的世界地图。然而,每次加载页面时都会给我一个404 error http://localhost:xxxx/world.geojson file not found
。无法在D3D中加载.geojson文件
这里是我的site.js文件:
$(function() {
d3.json("./world.geojson", createMap);
function createMap(countries) {
var aProjection = d3.geoMercator();
var geoPath = d3.geoPath().projection(aProjection);
d3.select("svg").selectAll("path").data(countries.features)
.enter()
.append("path")
.atrt("d", geoPath)
.attr("class", "countries");
}
});
这是我的项目结构是什么样子:structure
任何帮助,将不胜感激。谢谢!