2
我意識到這裏有一些例子,但我沒有任何運氣實際得到屬性的工作,所以我想我會問在這個具體的例子。我想從我的csv中獲取屬性,並通過公共標識將它追加到json文件中。使用topojson合併json和csv
沿
topojson -o final.json -e waste.csv -p population=population -p waste=waste, -p country=country -- world.json
我world.json文件的行如下(從邁克·博斯托克)
{"type":"Topology",
"objects":{"countries":
{"type":"GeometryCollection","bbox":[-179.99999999999997,-90.00000000000003,180.00000000000014,83.64513000000001],
"geometries":[{"type":"Polygon","id":4,"arcs":[[0,1,2,3,4,5]]},
{"type":"MultiPolygon","id":24,"arcs":[[[6,7,8,9]],[[10,11,12]]]},
{"type":"Polygon","id":8,"arcs":[[13,14,15,16,17]]},{"type":"Polygon","id":784,"arcs":[[18,19,20,21,22]]}
而下面是我waste.csv:
id,country,income,region,population,wpc,waste,future_pop,future_urban_pop,future_wpc,future_waste,organic,paper,plastic,glass,metal,other
8,Albania,LMI,ECA,"1,418,524",0.77,"1,088","3,488,000","2,006,000",1.2,"2,407",38,10,8,5,5,34
12,Algeria,LMI,MENA,"19,225,335",1.21,"23,288","42,882,000","31,778,000",1.45,"46,078",70,10,5,1,2,12
所以,你在說什麼,我應該做更多沿着topojson -o final.json -e waste.csv -p population = population,waste = waste - world.json? – fritzicus
我在說的是id必須是一個屬性。我更新了答案。檢查這個 – user3696882