Skip to main content

Split GeoJSON by feature count or file size and convert GeoJSON to and from GeoPackage

Project description

GeoSplit

A focused command-line tool that:

  • splits a GeoJSON FeatureCollection by feature count;
  • splits it by a strict maximum file size; and
  • converts GeoJSON to GeoPackage, or a GeoPackage layer back to GeoJSON.

The splitter has no runtime dependencies. GeoPackage support is optional.

View general or command-specific help at any time:

geosplit help
geosplit help split
geosplit help convert

Install

Requires Python 3.10 or newer. Install GeoSplit from PyPI:

python -m pip install geosplit

Include conversion support:

python -m pip install "geosplit[gpkg]"

Confirm the installation:

geosplit help

If the geosplit command is not on your system path, use python -m geosplit help and replace geosplit with python -m geosplit in the examples below.

Split GeoJSON

By feature count:

geosplit split world.geojson output --features 1000

By maximum file size:

geosplit split world.geojson output --size 10MB

Sizes accept B, KB, KiB, MB, MiB, GB, and GiB. Each resulting file is a complete, compact GeoJSON document whose on-disk size does not exceed the requested limit. If one feature cannot fit by itself, the command stops with a clear error.

Output files are numbered automatically, such as world_001.geojson, world_002.geojson, and so on. Use --prefix countries to customize their names or --force to replace matching files. A source collection's top-level bbox is omitted because it would no longer describe each split collection; other top-level metadata is retained.

Convert formats

# GeoJSON to GeoPackage
geosplit convert roads.geojson roads.gpkg

# Choose the new GeoPackage layer name
geosplit convert roads.geojson map.gpkg --output-layer roads

# GeoPackage to GeoJSON
geosplit convert map.gpkg roads.geojson --layer roads

If a GeoPackage contains exactly one layer, --layer is optional. Existing destinations are protected unless --force is supplied.

Update

python -m pip install --upgrade geosplit

License

MIT

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

geosplit-0.2.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

geosplit-0.2.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file geosplit-0.2.1.tar.gz.

File metadata

  • Download URL: geosplit-0.2.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for geosplit-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ae1f1ab837ac85f4ea391f7e9b09fafb6a7a14e4865f3984c8d447275e342976
MD5 c0608da13426fe128718d480b5df80ef
BLAKE2b-256 fdca034d3957ab979bdc40d8afdfdc4fdb8c7ec3c3558756bb2ad1fad54fe786

See more details on using hashes here.

File details

Details for the file geosplit-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: geosplit-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for geosplit-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17f4a0ad0b3d155742daf85b7c09d098c441961630d0a3788afaecf5fd9400f4
MD5 dcf49c41c9f14279388651d1ce7d037a
BLAKE2b-256 a25971f067c78e5300f83f52b8f1f62d019aee938bfc29ddc1484e6983ccff21

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