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.1

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.1
File Size Uploaded Provenance Actions
ibge_geodata-2.1.1.tar.gz 15.7 kB Without provenance Details for ibge_geodata-2.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 35.1 kB

Release files / ibge_geodata-2.1.1.tar.gz

Download URL ibge_geodata-2.1.1.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
41984fcf8557d7470d94af3b881f50d8d9aef9c13947b6e9a139abd78e2bbb09
BLAKE2b-256 checksum
How to use checksums
c9ed097a9b75f1400433efbb04be46a8febad18b8699d8ed9b431e51c3b5e5fc
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.1-py3-none-any.whl

Download URL ibge_geodata-2.1.1-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd631e3ba0b934107f33caec4c2830dd808b93e00a51e1ce3ad38a8ee67ab6be
BLAKE2b-256 checksum
How to use checksums
9d245213fbc9bf14c907558aaacba4c53cb4e411d3eafd5530e7eff4378a7b30
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.1

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