Papotch
Spatial ETL wannabe
Trying to build a user-friendly API to process spatial data around polars(_st) DataFrames.
Installation
From Pypi :
pip install papotch
Usage
papotch has 2 objects for now : Reader and Data.
from papotch import Reader
r = Reader("path/to/data.shp")
d = r.extract()
d.head()
┌──────┬───────────┬───────────┬────────────┬─────────────────────────────────┐
│ id ┆ value_int ┆ value_txt ┆ value_bool ┆ geometry │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ str ┆ bool ┆ str │
╞══════╪═══════════╪═══════════╪════════════╪═════════════════════════════════╡
│ 0 ┆ 0 ┆ test ┆ true ┆ POLYGON ((2532293.417834 11600… │
│ 1 ┆ 1 ┆ éjwefw ┆ false ┆ POLYGON ((2548329.72787 115443… │
│ 2 ┆ 2 ┆ kjprg ┆ false ┆ POLYGON ((2538461.229386 11469… │
│ null ┆ null ┆ null ┆ false ┆ POLYGON ((2532026.146 1159262.… │
│ null ┆ null ┆ null ┆ false ┆ POLYGON ((2530319.718138 11547… │
└──────┴───────────┴───────────┴────────────┴─────────────────────────────────┘
# Buffer, calculate the resulting area, then the bounding coordinates.
_ = d.buffer(distance=2).area(column_name="calc_area").bounds()
d.head()
┌──────┬───────────┬───────────┬────────────┬─────────────────────────────────┬────────────┬─────────────────────────────────┐
│ id ┆ value_int ┆ value_txt ┆ value_bool ┆ geometry ┆ calc_area ┆ _bounds │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ str ┆ bool ┆ binary ┆ f64 ┆ array[f64, 4] │
╞══════╪═══════════╪═══════════╪════════════╪═════════════════════════════════╪════════════╪═════════════════════════════════╡
│ 0 ┆ 0 ┆ test ┆ true ┆ b"\x01\x03\x00\x00\x20\x08\x08… ┆ 112.794919 ┆ [2.5323e6, 1.1601e6, … 1.1601e… │
│ 1 ┆ 1 ┆ éjwefw ┆ false ┆ b"\x01\x03\x00\x00\x20\x08\x08… ┆ 112.794919 ┆ [2.5483e6, 1.1544e6, … 1.1544e… │
│ 2 ┆ 2 ┆ kjprg ┆ false ┆ b"\x01\x03\x00\x00\x20\x08\x08… ┆ 112.794919 ┆ [2.5385e6, 1.1470e6, … 1.1470e… │
│ null ┆ null ┆ null ┆ false ┆ b"\x01\x03\x00\x00\x20\x08\x08… ┆ 112.794919 ┆ [2.5320e6, 1.1593e6, … 1.1593e… │
│ null ┆ null ┆ null ┆ false ┆ b"\x01\x03\x00\x00\x20\x08\x08… ┆ 112.794919 ┆ [2.5303e6, 1.1548e6, … 1.1548e… │
└──────┴───────────┴───────────┴────────────┴─────────────────────────────────┴────────────┴─────────────────────────────────┘
d.write("PG:service=my_service", layer="my_layer")
About Polars ST
The heavy lifting is done by Polars ST, papotch is just a thin opiniated wrapper that tries to simplify its usage and to give a "ETL-like" feeling.
Metadata
Release files for papotch 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| papotch-0.0.2.tar.gz | 40.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| papotch-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.9 kB
Release files / papotch-0.0.2.tar.gz
| Download URL | papotch-0.0.2.tar.gz |
|---|---|
| Size | 40.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe21bc380f3d8d19eff5a04d46e3ff6c31b6f6ebece4ae9e324ee342ccd3a17c
|
|
BLAKE2b-256 checksum How to use checksums |
1d1808941f494811f2ce2a740808581694747439c3360ee4b58e43853c11a19c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / papotch-0.0.2-py3-none-any.whl
| Download URL | papotch-0.0.2-py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd17b2a5bcc1eb941384d7620ca9cb824c507dc4e86973cd14114e210f0a629b
|
|
BLAKE2b-256 checksum How to use checksums |
887da8b861fc8ad1d4a1c08749121a1225ebcca6b8e3f7b56cb3739b3216ed2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|