Skip to main content

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.

Static ilçe-level map

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

turkiye-0.1.1.tar.gz (11.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

turkiye-0.1.1-py3-none-any.whl (11.6 MB view details)

Uploaded Python 3

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

Hashes for turkiye-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9482d909b29712c10e330bafb266740e1432a2e7aa3cd4471cb9eba99f7c80b9
MD5 81829a122d8bf8bc15c1c07af8b468ed
BLAKE2b-256 d53d4ee15628e5deae58b82208da1652057f2db32264456fc18cdc0594ba0411

See more details on using hashes here.

Provenance

The following attestation bundles were made for turkiye-0.1.1.tar.gz:

Publisher: release.yml on sencer/turkiye

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for turkiye-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3eea0c45398de73aa600c3ccf9d213fb0a9297223dbe8237e8f920926b963f40
MD5 1838b4b36060c31c917299cb03fca3d6
BLAKE2b-256 5cdfd8b88e0918658e441b2be9765f72a16dbac233d99494240a3c117cf341b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for turkiye-0.1.1-py3-none-any.whl:

Publisher: release.yml on sencer/turkiye

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page