Search code examples
jsond3.jsmakefiletopojson

topojson makefile has no country data


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"?


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