Skip to main content

korp-map-client (Python)

A Python data client for the korp-map server: OpenStreetMap rows for a bounding box as Arrow tables (or GeoDataFrames), plus address geocoding. For notebooks and analysis; it speaks the map wire, contract v1.2 (HTTP). Formerly published as korp-map (import korp_map); that name is now a deprecated shim that installs this package.

pip install korp-map-client             # pyarrow + httpx
pip install 'korp-map-client[geo]'      # + geopandas, shapely: map_gdf()
pip install 'korp-map-client[zstd,br]'  # + zstd / brotli Content-Encoding
pip install 'korp-map-client[all]'

Use

import korp_map_client

c = korp_map_client.Client("http://83.190.65.118:8765")  # region = the first served region
c.regions()        # [{"name": "sweden", "bbox": [...], "data_version": "files-..."}]

res = c.map("lines", bbox=(17.9, 59.2, 18.2, 59.4), lod=14)
res.table          # pyarrow.Table; schema metadata kept (geo, data_version, ...)
res.truncated, res.data_version, res.geometry_source, res.row_groups_scanned
res.to_pandas()

gdf = c.map_gdf("areas", bbox=(17.9, 59.2, 18.2, 59.4), lod=12)   # GeoDataFrame, EPSG:4326
gdf.attrs["truncated"]

c.geocode("Drottninggatan 53 Stockholm", max=5)   # [{"street", "housenumber", "city", "postcode",
                                                  #   "lon", "lat", "source", "score"}, ...]
c.revgeocode(18.07, 59.33)                        # {..., "distance_m": 11.9} or None
  • kind is points (tagged nodes), lines or areas.
  • bbox is (minlon, minlat, maxlon, maxlat); lod (0 to 20 or so) keeps rows with min_zoom <= lod and picks the geometry detail (geometry_source: z6, z9, z12, full).
  • max=K caps the rows; the reply then says truncated=True.
  • compress="zstd" asks for zstd Arrow IPC buffers (pyarrow decodes them).
  • tags is a JSON string per row: res.to_pandas().tags.map(json.loads).
  • MapResult speaks the Arrow stream protocol: polars.from_arrow(res), duckdb.sql("from res").
  • c.map_table(...) gives the bare pyarrow.Table.
  • korp_map_client.geometry_to_shapely(col) turns a separated-layout geometry column (struct<x, y> in lists, GeoParquet 1.1) into shapely geometries, vectorised.

Errors raise korp_map_client.KorpMapError; .code is the wire code (korp-map-108 for an unknown region, ...) and .status the HTTP status. Replies compressed with gzip, br or zstd are decoded transparently; Accept-Encoding names what is installed. https:// URLs work; extra keyword arguments go to httpx.Client (verify=, proxy=, ...).

Test

pip install -e '.[all,test]'
pytest                                          # the fake server
KORP_MAP_URL=http://127.0.0.1:8765 pytest -m live   # a running server (Stockholm queries)

License: MIT OR Apache-2.0.

Metadata

Release files for korp-map-client 0.1.0

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

Source distribution (sdist)

Source distribution for korp-map-client 0.1.0
File Size Uploaded Provenance Actions
korp_map_client-0.1.0.tar.gz 18.6 kB Without provenance Details for korp_map_client-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for korp-map-client 0.1.0
File Interpreter ABI Platform Actions
korp_map_client-0.1.0-py3-none-any.whl Python 3 none any Details for korp_map_client-0.1.0-py3-none-any.whl

Total release size: 33.0 kB

Release files / korp_map_client-0.1.0.tar.gz

Download URL korp_map_client-0.1.0.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6f05bd246aa247d554e6cdcab49c56fb9a38fc7e08f8f0b0a2d9712c5aa859e8
BLAKE2b-256 checksum
How to use checksums
0fdf3adfd89710029a9cc783dc7eb0954aaefb33a36b3a61093b5a9f51f4026d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / korp_map_client-0.1.0-py3-none-any.whl

Download URL korp_map_client-0.1.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afa77144e6eeeffb627eaf12c3f912f17e158fb0595c1217225f52671be78942
BLAKE2b-256 checksum
How to use checksums
7fb2643f8d1e34d6f694c55baa347a23993e78582f150ae861af94a336031c8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for korp-map-client 0.1.0

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.

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