##External Properties
Please see this visual editor that is available for editing properties of a topojson file.
Please refer to the external properties section of the Command Line Reference for the topojson tool to learn about how to merge properites from an external CSV file into an existing topojson file.
##Merging a region property for each country in Asia and Africa The output topojson should contain a modified properties object for each country in Asia or Africa. For example:
{
"type": "Polygon",
"properties": {
"name": "Algeria",
"region": "Africa"
},
"id": "DZA",
"arcs": [
[237, 238, 239, 240, 241, 242, 243, 244]
]
}
The input is likely to be a CSV with two columns. One column will contain the region, the second collumn will contain the name of the country (to allow the tool to map between the country in the CSV to the country entry in the topojson ). For example:
countryName,region
Algeria,Africa
Kenya,Africa
India,Asia
https://github.com/mbostock/topojson/wiki/Command-Line-Reference#external-properties
##Example: Merging regions into a US topojson Try to run the following command with the example files in this repo. It will help you get a sense for how this merge works. From there you can extrapolate to add your own external properties to any topojson.
topojson -o us-regions.json -e regions.csv --id-property=abbreviation,abbr -p +id,state,abbreviation,region -- us-labeled.json
In this example:
-o us-regions.json
specifies the output file-e regions.csv
refers to external CSV with the properties you want to import.--id-property=abbreviation,abbr
creates the mapping between theabbreviation
property in the original topojson input file and the abbr column in the CSV-p +id,state,abbreviation,region
specifies which properites should be kep in the output file.-- us-labeled.json
this last part of the command specifies the input file.