Skip to main content

A command-line tool for reducing the size of GeoJSON files.

Project description

GeoJSON-shave

Testing License versions


geojson-shave reduces the size of GeoJSON files by:

  • Truncating latitude/longitude coordinates to the specified decimal places.
  • Eliminating unnecessary whitespace.
  • (Optionally) replacing the properties key's value with null/empty dictionary.

This tool assumes that your GeoJSON file confirms to the RFC 7946.

Installation

$ pip install geojson-shave

Usage

GeoJSON-shave-demo

Simply pass the file path of your GeoJSON file and it will truncuate the coordinates to 5 decimal places, outputing to the current working directory:

$ geojson-shave roads.geoson

Alterntatively you can specify the number of decimal points you want the coordiantes truncuated to:

$ geojson-shave roads.geojson -d 3

You can also specify if you only want certain Geometry object types in the file to be processed:

$ geojson-shave roads.geojson -g LineString Polygon

Note that the -g option doesn't apply to objects nested within Geometry Collection.

And to reduce the file size even further you can nullify the property value of Feature objects:

$ geojson-shave roads.geojson -p

Output to a directory other than the current working directory:

$ geojson-shave roads.geojson -o ../data/output.geojson

TODO

  • Add support for passing the URL of a hosted GeoJSON file to the tool.

Project details


Download files

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

Source Distribution

geojson-shave-0.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geojson_shave-0.1.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file geojson-shave-0.1.1.tar.gz.

File metadata

  • Download URL: geojson-shave-0.1.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for geojson-shave-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c711e8fac43f378c170aeb0c965067c20cb72d7f5b76a368dfc7e15120ff7df4
MD5 81f42abe973761050d04942ee0b3a3c0
BLAKE2b-256 a38c4b0927d6244ca74dce025ee22941c4d2af9a5830c60f2170fd422caaa5d3

See more details on using hashes here.

File details

Details for the file geojson_shave-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: geojson_shave-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for geojson_shave-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 79d707d97aaaafbf41c65e50157170557acecc6b8e12e30da23f3a564f6448b7
MD5 2dbd740d1006c3649ac49d7938af4dcd
BLAKE2b-256 e9060eca87f81299f574527194ae3309be5fc975c0206e7cc0178e720b1c803c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page