Tools for plotting Türkiye administrative boundaries and resolving divisions
Project description
turkiye
Python helpers for plotting Türkiye administrative boundaries and resolving province/district identities.
The package bundles Türkiye ADM2 district boundaries, derives province boundaries from them, and subtracts major lake polygons from the default map so large inland waters are not colored as part of an administrative division.
Install
pip install turkiye
District Map
Data can identify districts with il and ilce columns. Turkish characters
and ASCII spellings are both accepted for matching, so ÇANAKKALE and
CANAKKALE point to the same province. Central districts can be matched by
either their district name or MERKEZ, so Şırnak's central district accepts
both SIRNAK and MERKEZ.
from turkiye import load_boundaries, plot
districts = load_boundaries("ilce")[["il", "ilce"]]
districts["example_value"] = range(1, len(districts) + 1)
ax = plot(
districts,
level="ilce",
color="example_value",
label="Example value",
backend="matplotlib",
)
Set backend="matplotlib" for static maps like the one above.
Plotting Backends
Use plot() with backend="plotly" for interactive maps or
backend="matplotlib" for static Matplotlib output. The explicit
plot_interactive() and plot_static() helpers are available when you want to
call a backend directly.
import pandas as pd
from turkiye import plot, plot_interactive, plot_static
province_values = pd.DataFrame(
{"value": [1, 2]},
index=pd.Index(["ANKARA", "ISTANBUL"], name="il"),
)
interactive_fig = plot(province_values, color="value")
same_interactive_fig = plot_interactive(province_values, color="value")
static_ax = plot(province_values, backend="matplotlib", color="value")
same_static_ax = plot_static(province_values, color="value")
For static output:
ax = plot(province_values, backend="matplotlib", color="value")
Boundary Data
from turkiye import load_boundaries
provinces = load_boundaries("il")
districts = load_boundaries("ilce")
The default bundled source supports il and ilce. Province geometries are
derived by dissolving the bundled district layer. belde and mahalle
identities can be resolved where historical metadata exists, but bundled
geometry falls back to the nearest available district geometry.
Boundary frames include il_aliases and ilce_aliases columns for inspection.
Plot joins use those aliases automatically: matching is case-insensitive,
Turkish/ASCII-insensitive, and central districts accept both their province
name and MERKEZ.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file turkiye-0.1.1.tar.gz.
File metadata
- Download URL: turkiye-0.1.1.tar.gz
- Upload date:
- Size: 11.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9482d909b29712c10e330bafb266740e1432a2e7aa3cd4471cb9eba99f7c80b9
|
|
| MD5 |
81829a122d8bf8bc15c1c07af8b468ed
|
|
| BLAKE2b-256 |
d53d4ee15628e5deae58b82208da1652057f2db32264456fc18cdc0594ba0411
|
Provenance
The following attestation bundles were made for turkiye-0.1.1.tar.gz:
Publisher:
release.yml on sencer/turkiye
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turkiye-0.1.1.tar.gz -
Subject digest:
9482d909b29712c10e330bafb266740e1432a2e7aa3cd4471cb9eba99f7c80b9 - Sigstore transparency entry: 1606330488
- Sigstore integration time:
-
Permalink:
sencer/turkiye@abc9965e36fd7d5d350b84d1320d5e5f78310074 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/sencer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@abc9965e36fd7d5d350b84d1320d5e5f78310074 -
Trigger Event:
release
-
Statement type:
File details
Details for the file turkiye-0.1.1-py3-none-any.whl.
File metadata
- Download URL: turkiye-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3eea0c45398de73aa600c3ccf9d213fb0a9297223dbe8237e8f920926b963f40
|
|
| MD5 |
1838b4b36060c31c917299cb03fca3d6
|
|
| BLAKE2b-256 |
5cdfd8b88e0918658e441b2be9765f72a16dbac233d99494240a3c117cf341b8
|
Provenance
The following attestation bundles were made for turkiye-0.1.1-py3-none-any.whl:
Publisher:
release.yml on sencer/turkiye
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turkiye-0.1.1-py3-none-any.whl -
Subject digest:
3eea0c45398de73aa600c3ccf9d213fb0a9297223dbe8237e8f920926b963f40 - Sigstore transparency entry: 1606330590
- Sigstore integration time:
-
Permalink:
sencer/turkiye@abc9965e36fd7d5d350b84d1320d5e5f78310074 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/sencer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@abc9965e36fd7d5d350b84d1320d5e5f78310074 -
Trigger Event:
release
-
Statement type: