AnswerBun.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!

Related Questions

Extrapolating arc via Python function

0  Asked on June 13, 2021 by julianno-sambatti

     

Attributes comparison

1  Asked on June 13, 2021 by maro

   

Grib Metadata with GDAL in Python

1  Asked on June 13, 2021 by user144118

     

Getting table of coordinates from polygon in QGIS

1  Asked on June 13, 2021 by moritz-caspar

         

QGIS Excluding One Variable from Labels

2  Asked on June 13, 2021 by ellie-kennedy

     

Mapbox GL: Possible to move navigation controls?

3  Asked on June 13, 2021 by louis-philippe-tessier

   

Select circular polygons in QGIS

2  Asked on June 12, 2021

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP