Question

I've been doing the d3 let's make a map tutorial and I'M SO CLOSE but something happened in merging the two json files because the final uk.json doesn't have the three letter country codes -- rendering my map useless because I can't assign a class to the subunits.

I read this from Mike Bostock that said topojson changed and to do this instead when creating the file:

  topojson \ 
            --id-property su_a3 \ 
            -p name=NAME \ 
            -p name \ 
            -o topo/uk.json \ 
            topo/subunits.json \ 
            topo/places.json 

which I ran in the Terminal but same output on the uk.json file. Any ideas? Do I need to make a subfolder within my directory called "topo"?

Was it helpful?

Solution

1. Working code: Quickly, I find in your code some diferences with mine. Try out this :

topojson \ 
    --id-property su_a3 \ 
    -p name=name \ 
    -p name=NAME \ 
    -o topo/uk.json \
    -- topo/subunits.json \ 
    topo/places.json 

I'haven't test it however. The topo/... path is also a difference with my code.

2. Missing: A possibility is that you lost this property upper in your workflow. The GIS file's data attribute name may have changed, etc.

3. Case sensitive: Check that the keys you call in your TOPOJSON match the keys within your GIS / Geojson file. This is case sensitive. To check within the shp file : QuantumGIS* > load the .shp file > Right click on layer > Open attribute table > There, look at the column's title.

*: or other GIS software

OTHER TIPS

I had the same issue, although after a while I realized that the doc says

-p, --properties feature properties to preserve; no name preserves all properties

So if you use -p without anything else, something like

topojson --id-property SU_A3 -p -o yourjson.json -- subunits.json places.json 

you will get all the features and you will be able to retrieve whatever field you want. I don't know how is that if you only want to map some attributes (I was having the same issue)

Anyway, hope this help

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top