Skip to main content

Baloon is a command-line tool and Python library for converting between geospatial vector formats. Convert BLN, Shapefile, GeoJSON, KML, GeoPackage, and SVG files quickly and easily.

Features

  • CLI and Python API: Use on the command line or import in your scripts
  • Single files and directories: Convert one file or entire folders (recursive)
  • Any-to-any conversion: Convert between supported formats
    • BLN is read-only (input only); SVG is write-only (output only)
  • Supported formats: BLN, Shapefile (.shp), GeoJSON (.geojson/.json), KML (.kml), GeoPackage (.gpkg), SVG (.svg)

Installation

# Using uv (recommended)
uv add baloon

# Using pip
pip install baloon

Usage

Command Line

Note: Options must come before positional arguments.

Basics (auto-detect by extension):

uv run baloon input.bln output.geojson
uv run baloon data.geojson output.shp
uv run baloon map.kml output.gpkg

Help and usage:

uv run baloon --help

Explicit formats (ambiguous extensions or forcing a format):

# When extensions are ambiguous
uv run baloon --input-format bln --output-format geojson input.txt output.json

# Force output format regardless of extension
uv run baloon --output-format shp input.geojson output.data

Overwrite behavior (single file conversions):

# Overwrite existing output file
uv run baloon --overwrite input.bln output.geojson

Directory conversions (recursive):

# Convert all supported readable files under ./data to GeoJSON in ./out-geojson
uv run baloon --output-format geojson ./data ./out-geojson

# Convert all supported readable files under ./project to Shapefile in ./out-shp
uv run baloon --output-format shp ./project ./out-shp

Notes for directory conversions:

  • The output path must be a directory; it will be created if it does not exist.
  • Input formats are auto-detected per file. Unsupported formats and write-only inputs (e.g., SVG) are skipped with a warning.
  • The relative directory structure is preserved in the output.
  • Existing output files are overwritten.

Advanced bash loops (custom naming and filters):

# Convert only KML files to GPKG, preserving stems next to inputs
find data -type f -name '*.kml' -print0 | while IFS= read -r -d '' f; do
  out="${f%.*}.gpkg"
  uv run baloon "$f" "$out"
done

# Convert mixed inputs to GeoJSON into ./out, mirroring structure
find data -type f \( -name '*.bln' -o -name '*.kml' -o -name '*.shp' -o -name '*.gpkg' -o -name '*.geojson' -o -name '*.json' \) -print0 \
| while IFS= read -r -d '' f; do
  rel="${f#data/}";
  base="${rel%.*}";
  mkdir -p "out/$(dirname "$base")";
  uv run baloon "$f" "out/${base}.geojson"
done

# Convert to multiple target formats (two passes)
for fmt in geojson shp; do
  uv run baloon --output-format "$fmt" ./data "./out-$fmt"
done

Path tips:

  • Quote paths with spaces: uv run baloon "My Data/input.kml" "Out/maps.gpkg".
  • Shapefile outputs create a set of files (.shp, .shx, .dbf, etc.) next to the .shp path you provide.
  • BLN is input-only; SVG is output-only. Reading SVG in single-file mode will error; in directory mode SVG inputs are skipped.

Python API

Quick conversions (any format → any format):

import baloon

# Prefer simple aliases: convert, convert_dir, read_bln

# Convert single file (auto-detects by extension)
baloon.convert('input.bln', 'output.geojson')
baloon.convert('data.geojson', 'boundaries.shp')

# For ambiguous extensions, prefer the CLI with --input-format/--output-format
# (BLN is input-only; SVG is output-only)

Batch convert directories (Python API):

import baloon

# Convert all supported readable files in a directory to GeoJSON
# - Preserves relative structure
# - Skips write-only inputs (e.g., SVG)
baloon.convert_dir('./data/', 'geojson')

Working with BLN data:

from baloon import read_bln
from pathlib import Path

# Parse BLN file
records = read_bln(Path('boundary.bln'))
print(f'Found {len(records)} coordinate points')

# Access coordinates
for record in records:
    print(f'Point: {record.x}, {record.y}')

Load any format as GeoDataFrame:

from baloon.formats import load_any
from pathlib import Path

# Load any supported format as GeoDataFrame
gdf = load_any(Path('data.geojson'))  # or .shp, .kml, .gpkg, .bln
print(f'Loaded {len(gdf)} features')
print(gdf.head())

Supported Formats

Format Extension Read Write Description
BLN .bln ✅ ❌ Golden Software polygon files
Shapefile .shp ✅ ✅ ESRI standard with components
GeoJSON .geojson, .json ✅ ✅ RFC 7946 feature collections
KML .kml ✅ ✅ Google Earth format
GeoPackage .gpkg ✅ ✅ OGC SQLite-based format
SVG .svg ❌ ✅ Scalable vector graphics

Tips

  • If your file has a non-standard extension, use CLI format flags:
    • uv run baloon --input-format bln --output-format geojson input.txt output.txt
  • Use the Python API for batch conversions and programmatic workflows.

License

This project is licensed under the GPL-3.0-or-later. See the LICENSE file for details.

Metadata

Release files for baloon 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for baloon 1.0.1
File Size Uploaded Provenance Actions
baloon-1.0.1.tar.gz 688.3 kB Without provenance Details for baloon-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for baloon 1.0.1
File Interpreter ABI Platform Actions
baloon-1.0.1-py3-none-any.whl Python 3 none any Details for baloon-1.0.1-py3-none-any.whl

Total release size: 730.0 kB

Release files / baloon-1.0.1.tar.gz

Download URL baloon-1.0.1.tar.gz
Size 688.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b026a7143052ff4b50be4bc54bf443ef4d843038c19de749ad666baa36c36b8a
BLAKE2b-256 checksum
How to use checksums
3dee28c0b8b18f4aacd4377474fbf2dd729ef46b755f7dd11031a62655730617
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Release files / baloon-1.0.1-py3-none-any.whl

Download URL baloon-1.0.1-py3-none-any.whl
Size 41.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcd8932a1577437daa7a7e4047978e9e3a7cba118fcc8c59303e0489b2cb6c53
BLAKE2b-256 checksum
How to use checksums
e9de10483631f95c54ed3c4ebe7c6ba8c85704ee2dd941f4fa9d28ead8755abb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Security for baloon 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page