ibge-geodata
Python package for downloading, organising, and querying Brazilian territorial data published by IBGE.
It combines administrative meshes, tabular metadata, point localisation, and coordinate utilities behind a small typed API.
What Is Included
- Administrative polygons for country, region, intermediate region, immediate region, state, and municipality
- Metadata aligned by
idin ready-to-useDataFrameandGeoDataFrameobjects - Point-in-polygon localisation across multiple IBGE levels with a reusable cached locator
- Validated WGS-84 coordinates with distance, bearing, shapely conversion, and UTM transforms
- One-line plotting through GeoPandas for quick exploratory maps
Installation
pip install ibge-geodata
Python 3.11 or newer is required.
Quick Example
from geodata import GeoData, GeoLevel, GeoLocator, Quality
from geodata.utils.geocoords import GeoCoords
# Download polygons plus aligned metadata
states = GeoData(GeoLevel.STATE, Quality.LOW)
print(states.polygons[["id", "nome", "sigla"]].head())
# Plot directly with GeoPandas
states.plot(figsize=(10, 8), edgecolor="white", linewidth=0.4)
# Locate a point across administrative levels
locator = GeoLocator(quality=Quality.LOW)
brasilia = GeoCoords(lat=-15.7801, lon=-47.9292)
location = locator.locate(brasilia)
print(location.to_dict())
# {
# 'municipality': 'Brasília',
# 'state': 'Distrito Federal',
# 'immediate_region': 'Brasília',
# 'intermediate_region': 'Brasília',
# 'region': 'Centro-Oeste'
# }
# Geodesic utilities
manaus = GeoCoords(lat=-3.1190, lon=-60.0217)
print(round(brasilia.distance_to(manaus), 1))
print(round(brasilia.bearing_to(manaus), 1))
# CRS conversion
easting, northing = brasilia.to_utm("EPSG:32722")
restored = GeoCoords.from_utm(easting, northing, "EPSG:32722")
print(restored)
Core API
| Object | Purpose |
|---|---|
GeoData |
Downloads IBGE meshes and returns metadata or merged polygon layers |
GeoLocator |
Resolves the municipality, state, region, and IBGE regional divisions that contain a point |
GeoCoords |
Validates coordinates and provides geodesic and CRS conversion helpers |
GeoLevel |
Enumerates supported territorial levels |
Quality |
Controls mesh resolution and download weight |
Typical Workflows
Download a territorial layer
municipalities = GeoData(GeoLevel.MUNICIPALITY, Quality.MEDIUM)
gdf = municipalities.polygons
Inspect metadata only
states = GeoData(GeoLevel.STATE, Quality.LOW)
print(states.metadata.columns)
Reuse a locator for many points
locator = GeoLocator()
for coords in [
GeoCoords(lat=-23.5505, lon=-46.6333),
GeoCoords(lat=-30.0346, lon=-51.2177),
]:
print(locator.locate(coords).state)
Documentation
Full documentation: victorbenezoli.github.io/geodata
- Quickstart: practical usage patterns
- API reference: classes, enums, and return types
- Examples: mapping, localisation, and coordinate conversion
- FAQ: quality, performance, and persistence tips
Data Sources
- IBGE Mesh API for polygons
- IBGE Localities API for administrative metadata
License
GPL. See LICENSE.md.
Metadata
Release files for ibge-geodata 2.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 | Provenance | Actions |
|---|---|---|---|---|
| ibge_geodata-2.0.2.tar.gz | 12.9 kB | Without provenance | Details for ibge_geodata-2.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ibge_geodata-2.0.2-py3-none-any.whl | Python 3 | none | any | Details for ibge_geodata-2.0.2-py3-none-any.whl |
Total release size: 27.8 kB
Release files / ibge_geodata-2.0.2.tar.gz
| Download URL | ibge_geodata-2.0.2.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c3da326156663dee4d126bf9d218519e9bbae0c46693a72ab47471187fe1b48
|
|
BLAKE2b-256 checksum How to use checksums |
fa2884957d43a507febf51a79779cac238e64364bb6ed01bb151312d15fc2dac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.4 Linux/7.0.0-22-generic
|
Release files / ibge_geodata-2.0.2-py3-none-any.whl
| Download URL | ibge_geodata-2.0.2-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6898ebc3ce88f972e527d4d925e4909727f1e97565e4884bd511272184684904
|
|
BLAKE2b-256 checksum How to use checksums |
36fd8904b5cb8653c9f1ef0226038ea9a68c9ecfd677dc23529ad67d1bf43b15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.4 Linux/7.0.0-22-generic
|
Security for ibge-geodata 2.0.2
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.