Skip to content

IBGE GeoData

ibge-geodata

PyPI Python License

ibge-geodata is a Python package for consuming Brazilian territorial data from IBGE with a workflow oriented around GeoPandas, validated coordinates, and reproducible administrative lookups.

What Changed In 2.0

  • Unified territorial access

Load country, region, intermediate region, immediate region, state, or municipality layers from the same GeoData API.

  • Merged metadata and geometry

Use metadata for plain tabular data or polygons for a merged GeoDataFrame keyed by id.

  • Reusable point locator

GeoLocator caches boundary layers and returns a structured GeoLocation object for repeated queries.

  • Coordinate utilities

GeoCoords validates latitude and longitude, computes distance and bearing, and converts between WGS-84 and projected CRS values.

Install

pip install ibge-geodata

Requires Python 3.11 or newer.

First Look

from geodata import GeoData, GeoLevel, GeoLocator, Quality
from geodata.utils.geocoords import GeoCoords

states = GeoData(GeoLevel.STATE, Quality.LOW)
print(states.polygons[["id", "nome", "sigla"]].head())

locator = GeoLocator()
point = GeoCoords(lat=-15.7801, lon=-47.9292)
location = locator.locate(point)

print(location.state)
print(location.municipality)
print(location.to_dict())

Main Concepts

Object Description
GeoData Entry point for polygon download, metadata retrieval, and direct plotting
GeoLocator Point-in-polygon lookup across IBGE administrative layers
GeoCoords Validated WGS-84 coordinate object with geodesic and CRS helpers
GeoLevel Enumeration of supported territorial levels
Quality Resolution strategy for boundary downloads

Documentation Map

Page Use it for
Installation Environment requirements and local setup
Quickstart Core workflows with copy-paste examples
Examples End-to-end snippets for maps, localisation, and CRS conversion
FAQ Performance, border cases, and export guidance
Contributing Development workflow and project contribution

Why Use It

  • It removes most of the boilerplate around IBGE mesh and locality endpoints.
  • It keeps geometry and metadata aligned in a predictable tabular shape.
  • It gives you a single coordinate model for validation, distance, bearing, and projection transforms.
  • It makes repeated localisation practical by caching polygon layers inside the locator.