我正在努力調整閱讀json文件後自動調整的json文件大小。但我收到錯誤。如何使用TopoJSON閱讀geojson文件
$.getJSON("data/cities.json", function (data) {
getData = topojson.feature(data, data.features);
console.log(getData)
});
Cities.json樣子
{
"type": "FeatureCollection",
"features": [{
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-73.8283219965448, 40.8446061654002],
[-73.828397789942, 40.844583182304],
[-73.8285477331865, 40.8448132168025],
[-73.8284744943625, 40.8448401137412],
[-73.8283219965448, 40.8446061654002]
]
]
]
},
"type": "Feature",
, {
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-73.832361912256, 40.8488019205992],
[-73.832369554769, 40.8487286684528],
[-73.8327312374341, 40.8487518102579],
[-73.8327304815978, 40.8487590590352],
[-73.8327235953166, 40.8488250624279],
[-73.832361912256, 40.8488019205992]
]
]
]
},
"type": "Feature"
}
}
我怎樣才能使用的getJSON然後通過其加載JSON數據topojson
你會得到什麼錯誤? –
未捕獲TypeError:對象#
你如何在頁面中包含topojson?好像它沒有正確加載 –