Skip to main content

CLI for converting TopoJSON files to GeoJSON

Project description

topo2geo

CLI for converting TopoJSON files to GeoJSON

Installation

pip install topo2geo

Depends on shapely and click

Usage

[~]$ topo2geo input.topojson output.geojson

Multilayered Topojsons

If the topojson contains mulitple layers (i.e. there are multiple values in the "objects" key). Then seperate geojson files will be output with the layer name.

For example a topojson containing states and counties:

{
    "type": "Topology",
    "objects": {
        "county": {
            "type": "GeometryCollection",
            "geometries": [...]
        },
        "state": {
            "type": "GeometryCollection",
            "geometries": [...]
        }
    }
}

would produce two geojson files, output_geo_county.json and output_geo_state.json

Troubleshooting

If you experience a "segmentation fault" one thing to try is explained here:

pip install shapely --no-binary shapely

Credits

Originally written by sgillies and perrygeo. Converted to Python3 and packaged into a CLI by kylepollina.

Sources:


License - https://github.com/topojson/topojson/blob/master/LICENSE.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for topo2geo, version 0.4.4
Filename, size File type Python version Upload date Hashes
Filename, size topo2geo-0.4.4-py3-none-any.whl (4.3 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page