Skip to main content

IBGE GeoData

ibge-geodata

PyPI Python License Docs

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 id in ready-to-use DataFrame and GeoDataFrame objects
  • 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.1.2

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

Source distribution (sdist)

Source distribution for ibge-geodata 2.1.2
File Size Uploaded Provenance Actions
ibge_geodata-2.1.2.tar.gz 15.3 kB Without provenance Details for ibge_geodata-2.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ibge-geodata 2.1.2
File Interpreter ABI Platform Actions
ibge_geodata-2.1.2-py3-none-any.whl Python 3 none any Details for ibge_geodata-2.1.2-py3-none-any.whl

Total release size: 34.3 kB

Release files / ibge_geodata-2.1.2.tar.gz

Download URL ibge_geodata-2.1.2.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4a7ede5e03966e5cb5bc24a772cc2739f3f99cbdacea7ad2f37d0e1c973a0464
BLAKE2b-256 checksum
How to use checksums
a08c0c0ac96929479b9783d8be07874e930000fee322d7615412189318aff23e
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-30-generic

Release files / ibge_geodata-2.1.2-py3-none-any.whl

Download URL ibge_geodata-2.1.2-py3-none-any.whl
Size 18.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
714aa2dd12d125dbc1949600bee7773d3c405ed1a965abf7a652a863347990b4
BLAKE2b-256 checksum
How to use checksums
6d8605da6a87427c7274ca4e67597941ff0408a3d873c5b45f43f3c5c2343aa9
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-30-generic

Security for ibge-geodata 2.1.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.

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