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

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.0
File Size Uploaded Provenance Actions
ibge_geodata-2.1.0.tar.gz 15.5 kB Without provenance Details for ibge_geodata-2.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 34.7 kB

Release files / ibge_geodata-2.1.0.tar.gz

Download URL ibge_geodata-2.1.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f542323cf589f36c935e1924762d916718082cf16fe1e0459dc007a0242689b0
BLAKE2b-256 checksum
How to use checksums
7da30891c28c621c54df04130ef899580a587de61638b6bacdd2254103f1522d
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-27-generic

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

Download URL ibge_geodata-2.1.0-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27dbf114b41910d9be51702948c7083ae2ce47fe26cbe5d8e5addbc282140fda
BLAKE2b-256 checksum
How to use checksums
be38102f07a29f6a9fe50ab66426d7243c0f132d5f5d4bca676a81b15e905d8e
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-27-generic

Security for ibge-geodata 2.1.0

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