Metadata-Version: 2.4
Name: polars-geojson
Version: 0.3.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
License-File: LICENCE
Summary: GeoJSON Writer Plugin for Polars and WKB Interp
Author-email: Ben Burwood <ben.burwood@streetwave.co>
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# polars-geojson

A Polars Plugin for GeoJSON IO, built with Rust via pyo3-polars.

Motivation: Converting of DataFrames with GeoJSON-compatible geometry columns to GeoJSON Feature Collections, for Map Plotting.

Features:
- Expression for converting WKB (Well-Known Binary) Geometry Columns to GeoJSON
- DataFrame Iterator for generating GeoJSON Features
- DataFrame Writer for writing GeoJSON Feature Collections
- H3 Handling - Cell Geometry

## Installation

```bash
maturin develop --release
```

## Usage

Must include `import polars_geojson` in all Python files that use this Plugin to Register the namespace.

### Expression-level: WKB to GeoJSON strings

```python
import polars as pl
import polars_geojson

df = df.with_columns(
    pl.col("geometry").geojson.from_wkb().alias("geojson_str")
)
```

### DataFrame-level: Generate GeoJSON Features

```python
features = df.geojson.to_features(
    columns_to_include=["name", "value"],   # optional, defaults to all non-geometry columns
    geometry_column="geojson",              # default
    extra_feature_keys=None,                # optional
)

for feature in features:
    print(feature)
# {"type": "Feature", "geometry": {"type": "Point", "coordinates": [1.0, 2.0]}, "properties": {"name": "alice", "value": 1}}
```

