GIS 到 Topojson:
我正在使用DIVA-gis.org作为我的数据源。我已经下载了亚美尼亚行政区域的数据。此下载会生成一个 .shp 文件。我试图将它直接传递给 topoJSON,我得到一个 json 文件,如下所示
Object {
type: "Topology",
objects: Object,
arcs: Array[1],
transform: Object
}
Topojson 到 SVG:
我将 d3 指向包含我的几何属性的 objects.armenia。问题是几何属性包含一个弧数组,它是 0。现在在我的亚美尼亚 topoJSON 中,我确实看到了一个弧属性数组,其中包含相当大的值数组......我已经尝试将我的 d3 代码指向那个元素,但我仍然一无所获。
除此之外,我还使用 QGIS 将我的 .shp 文件转换为 geoJSON,他们使用 topoJSON 从 geoJSON 从 topoJSON ......但仍然没有。我的d3代码如下
var width = 960,
height = 500;
var projection = d3.geo.mercator()
.scale(1000)
.translate([width / 2, height / 2]);
var path = d3.geo.path()
.projection(projection);
var mapContainer = d3.select("#armenia").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("/ARM_adm/output.json", function(error, country) {
console.log("country",country)
mapContainer.insert("path", ".graticule")
.datum(topojson.feature(country, country.armenia))
.attr("class", "land")
.attr("d", path);
});
我只是得到了一条空路......任何帮助都会非常感激。