TransWikia.com

Merging CSV data into TopoJSON file

Geographic Information Systems Asked by TravMatth on October 19, 2020

I have a file, Council_Districts.topojson, with the following structure:

{ type: 'Topology', arcs: [...], transform: {...}, objects: {
  Council_Districts_2016: {
    type: 'GeometryCollection',
    geometries: [
      {
        arcs: [...],
        type: '...',
        properties: {
          'DISTRICT': 0,
          'ID': 0,
          'OBJECTID': 0,
        }
      },
      ...
    ]    
  }
}

I also have a `Sample_Data.csv’ file with the following structure:

DISTRICT, varA, varB, ....,
0, .1, .2, ...

I’m looking to combine these two files such that my output file has the following structure:

{ type: 'Topology', arcs: [...], transform: {...}, objects: {
  Council_Districts_2016: {
    type: 'GeometryCollection',
    geometries: [
      {
        arcs: [...],
        type: '...',
        properties: {
          'DISTRICT': 0,
          'ID': 0,
          'OBJECTID': 0,
          'varA': .1,
          'varB': .2,
        }
      },
      ...
    ]
  }    
}

Googling around, I’m finding the previous answer has been to use the external properties flag on the topojson cli, e.g. topojson -e blah, but this flag does not seem to be available within the current topojson 2.0

2 Answers

You could use the great mapshaper cli. The join command is something like

mapshaper input.topojson -join "input.csv" keys=DISTRICT -o output.geojson

Answered by aborruso on October 19, 2020

Use QGIS to convert your CSV to GeoJSON then upload your GeoJSON to MapShaper.org or geojson.io and download as other formats they support, like TopoJSON.

Answered by GeospatialInformationTech on October 19, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP