结合多个geojson文件w tsv并使用topojson保留属性

时间:2013-08-12 03:12:08

标签: d3.js topojson

我正在尝试做很多事情吗?topojson ...结合2个geojson文件w 1 tsv,加入ELECT_DIV n NAME,将其提升为id,并保留tsv中的2012_POP。

这是我正在使用的命令:

topojson -o electorates.json -e 2012_oz_population.tsv --id-property ELECT_DIV,NAME -p 2012_POP -s .0000005 --allow-empty -- electorates.geojson region.geojson

ELECT_DIV在electorates.geojson。它被设置为所有功能的ID,但每个功能都没有从tsv的连接中获得正确的2012_POP。然而,在最高级别,选民和地区从tsv获得2012_POP的最后价值,所以它以某种方式加入......

关于我做错了什么的任何想法?我需要在多个拓扑命令中执行此操作吗?

谢谢!

更新W请求的信息
2012_oz_population.tsv
CED_CODE NAME 2011_POP 2012_POP
101 Banks 154938 156527

electorates.geojson
"features": [ { "type": "Feature", "properties": { "ELECT_DIV": "Lingiari", "STATE": "NT", "NUMCCDS": 335.0, "ACTUAL": 0.0, "PROJECTED": 0.0, "POPULATION": 0.0, "OVER_18": 0.0, "AREA_SQKM": 1352034.05, "SORTNAME": "Lingiari" }, "geometry": { "type": "MultiPolygon",

region.geojson
"features": [ { "type": "Feature", "properties": { "scalerank": 5, "featurecla": "Admin-0 country", "labelrank": 5.0, "sovereignt": "Australia", "sov_a3": "AU1", "adm0_dif": 1.0, "level": 2.0, "type": "Dependency", "admin": "Ashmore and Cartier Islands", "adm0_a3": "ATC", "geou_dif": 0.0, "geounit": "Ashmore and Cartier Islands", "gu_a3": "ATC", "su_dif": 0.0, "subunit": "Ashmore and Cartier Islands", "su_a3": "ATC", "brk_diff": 0.0, "name": "Ashmore and Cartier Is.", "name_long": "Ashmore and Cartier Islands", "brk_a3": "ATC", "brk_name": "Ashmore and Cartier Is.", "brk_group": null, "abbrev": "A.C.Is.", "postal": "AU", "formal_en": "Territory of Ashmore and Cartier Islands", "formal_fr": null, "note_adm0": "Auz.", "note_brk": null, "name_sort": "Ashmore and Cartier Islands", "name_alt": null, "mapcolor7": 1.0, "mapcolor8": 2.0, "mapcolor9": 2.0, "mapcolor13": 7.0, "pop_est": -99.0, "gdp_md_est": -99.0, "pop_year": -99.0, "lastcensus": -99.0, "gdp_year": -99.0, "economy": "7. Least developed region", "income_grp": "5. Low income", "wikipedia": -99.0, "fips_10": null, "iso_a2": "-99", "iso_a3": "-99", "iso_n3": "036", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99.0, "adm0_a3_is": "AUS", "adm0_a3_us": "ATC", "adm0_a3_un": -99.0, "adm0_a3_wb": -99.0, "continent": "Oceania", "region_un": "Oceania", "subregion": "Australia and New Zealand", "region_wb": "East Asia & Pacific", "name_len": 23.0, "long_len": 27.0, "abbrev_len": 7.0, "tiny": -99.0, "homepart": -99.0 }, "geometry": { "type": "Polygon", "coordinates":

现在我已经把它写出来了(并想出如何在Stackoverflow中像小丑一样进行基本降价),我想知道,它是否被赶上了region.geojson中名称的连接?

@ postock

帮助很多

1 个答案:

答案 0 :(得分:0)

如此令人尴尬(因为这发生在我之前),这是因为我使用的是topojson的过时版本。

在我将版本更新为1.2.3(使用npm update -g topojson)后,使用上述命令适当地映射了属性。

无论迈克如何回应。我担心这是我的结果。唉,它是。