TopoJson makefile 忽略外部属性文件

TopoJson makefile ignoring external properties file

我正在尝试使用 makefile 制作一个嵌入了 csv 数据的 topojson 文件。我正在使用 Mike Bostock 的 us-atlas 作为指南。

topo/us-counties-10m-ungrouped.json: shp/us/counties.shp
    mkdir -p $(dir $@)
    topojson \
      -o us_counties.json \
      --no-pre-quantization \
      --post-quantization=1e6 \
      --external-properties=output.csv \
      --id-property=FIPS \
      --properties="County=County" \
      --properties="PerChildrenPos=+PerChildrenPos" \
      --simplify=7e-7 \
      -- $<

它创建了我需要的 topojson 但完全忽略了 output.csv 文件。 这是它 return 的一瞥。

{"type":"Polygon","id":"53051","properties":{"code":"53051"},"arcs":[[-22,79,80,-75,81]]}

这是我需要的return。

{"type":"Polygon","id":"53051","properties":{"code":"53051", "County":"Los Angeles", "PerChildrenPos": 10},"arcs":[[-22,79,80,-75,81]]}

知道为什么它可能会忽略 csv 文件吗,我已经测试过移动它以查看它是否无法访问或其他原因?

提前致谢。

根据此处的文档:https://github.com/mbostock/topojson/wiki/Command-Line-Reference#external-properties

(If your CSV file uses a different column name for the feature identifier, you can specify multiple id properties, such as --id-property=+FIPS,+id.)

您似乎需要将 --id-property=FIPS \ 更改为与您的 CSV 列名称相对应的内容。

也适用于--properties="County=County" \
我觉得应该是--properties County=+County \

--properties="PerChildrenPos=+PerChildrenPos" \
也一样 应该是 --properties PerChildrenPos=+PerChildrenPos \

对于--external-properties=output.csv \
应该是 --external-properties output.csv \

基本上参数不需要以=符号作为前缀。