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

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.0.3
File Size Uploaded Provenance Actions
ibge_geodata-2.0.3.tar.gz 12.9 kB Without provenance Details for ibge_geodata-2.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 27.8 kB

Release files / ibge_geodata-2.0.3.tar.gz

Download URL ibge_geodata-2.0.3.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f998cc88fd226b8928fef05f8c7bf2c753ebacccb25e585b45613f5f6dcf67f2
BLAKE2b-256 checksum
How to use checksums
6c503812c92d381601222c959a200631d536066c3d4b0499df0d3feb3044a18a
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.3-py3-none-any.whl

Download URL ibge_geodata-2.0.3-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1251137889448c7d705e9322167a21614cf9e0dffdfdde1870f2dcc651b6570a
BLAKE2b-256 checksum
How to use checksums
69df1059d06f32694c9a7dfde34b5abaf4894c82f2aa6447422338d1293b750f
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.3

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