简体   繁体   中英

How do I convert geojson and shp files to topojson files using gdal?

I have successfully installed Python and GDAL with guidance from this link Installation instructions

I've seen some web tools that can convert to and fro the formats I mentioned above. I decided to install ogr2ogr locally. I need some simple instructions to bring up the command tool and convert my files. Most important is the switch to preserve properties or id of the geometries.

According to the GDAL webpage for the GeoJSON driver , GDAL supports reading TopoJSON as of OGR 1.11. It says nothing about writing TopoJSON, so I am assuming writing is not supported.

From the TopoJSON readme , the binary geo2topo will convert GeoJSON to TopoJSON in-place . It looks like that is the tool you should be using, not ogr2ogr .

The workflow would therefore be as follows:

shapefile translated to GeoJSON with ogr2ogr
GeoJSON updated to TopoJSON with geo2topo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM