Skip to content

bruno-portfolio/agrobr-qgis

Repository files navigation

agrobr-qgis

Brazilian agricultural data in QGIS with one click

Tests Python 3.12+ QGIS 4.0+ License: GPL-2.0+ Code style: ruff agrobr

Leia em Português

QGIS 4 plugin that exposes agrobr library data as geospatial and tabular layers, with native Qt6 GUI.

Centralizes 24 Brazilian agricultural data sources (IBGE, CONAB, INPE, IBAMA, MapBiomas, etc.) in a single plugin, eliminating manual ETL, scattered downloads, and manual joins with municipal boundaries.

Requirements

Component Version
QGIS 4.0+
Python 3.12+
agrobr >=1.0.0,<2.0.0

QGIS 3.x is not supported. This plugin targets QGIS 4 / Qt6 exclusively.

Installation

Via Plugin Manager (recommended)

  1. Open QGIS 4
  2. Go to Plugins → Manage and Install Plugins
  3. Search for agrobr
  4. Click Install Plugin

The plugin auto-installs the agrobr[geo] dependency on first run.

Manual

pip install agrobr[geo]

Copy the agrobr_qgis/ folder to the QGIS plugins directory:

  • Linux: ~/.local/share/QGIS/QGIS4/profiles/default/python/plugins/
  • Windows: %APPDATA%\QGIS\QGIS4\profiles\default\python\plugins\
  • macOS: ~/Library/Application Support/QGIS/QGIS4/profiles/default/python/plugins/

Usage

  1. Enable the plugin in Plugin Manager
  2. The agrobr dock panel appears on the side
  3. Browse source categories (Environmental, Production, Land, Regulatory)
  4. Select a source, fill in parameters
  5. Click Fetch Data
  6. Review the summary (features, CRS, geometry type)
  7. Add to map as a layer

Geospatial Sources

Wildfire hotspots (INPE), Deforestation (PRODES/DETER), FUNAI, ICMBio, INCRA, IBAMA, SICAR, ANA, SFB, MapBiomas Alerts.

Tabular Sources

CONAB, IBGE, ZARC.

Tabular sources can be converted to geospatial layers via automatic municipal join with the IBGE boundary mesh.

Templates

Pre-built multi-source compositions for common workflows:

  • Environmental X-Ray — fires + deforestation + embargoes + rural properties + conservation units for a given state
  • Production Analysis — PAM + CONAB for a product
  • Climate Risk — ZARC + PAM for a crop

Select a template from the tree, fill shared parameters, and fetch all sources at once. Results are grouped in the layer tree.

Processing Toolbox

Each source is also available as a Processing Toolbox algorithm, enabling use in models and scripts.

Features

  • Background-first — all fetches run in background, UI never blocks
  • Offline-first — agrobr cache enables offline usage
  • Memory-first — small layers in memory, automatic GPKG fallback for large datasets
  • Municipal join — tabular data → IBGE mesh with a single checkbox
  • Auto-validation — CRS, invalid geometries, encoding, timezone
  • Source search — filter by name, description, or category
  • Health check — online/offline status per source on category expand
  • Temporal animation — temporal controller for time-series sources (fires, deforestation, commodities)
  • Auto-styling — default QML styles per geometry type (point, polygon, line)
  • Templates — multi-source compositions (Environmental X-Ray, Production Analysis, Climate Risk)
  • Post-fetch actions — open attribute table, save as file, view origin URL
  • Project persistence — parameter cache saved/restored with QGIS project
  • Corporate proxy — auto-propagates QGIS proxy settings

Architecture

agrobr_qgis/
  core/          # Business logic (no Qt GUI)
  sources/       # 1 adapter per source (Registry pattern)
  gui/           # Qt6 interface (dock, panels, widgets)
  processing/    # Processing Provider (1 algorithm per source)

Development

git clone https://github.com/bruno-portfolio/agrobr-qgis.git
cd agrobr-qgis

pip install ruff mypy pytest pytest-cov agrobr[geo]
pre-commit install
ruff check agrobr_qgis/ tests/       # Lint
mypy agrobr_qgis/                     # Type check
pytest tests/unit/ -v                 # Unit tests
pytest tests/edge_cases/ -v           # Edge cases

See CONTRIBUTING.md for the full guide.

License

  • Plugin: GPL-2.0-or-later — see LICENSE
  • agrobr: MIT (compatible)
  • Data: belongs to their respective public sources

About

QGIS 4 plugin that brings Brazilian agricultural data directly into your map canvas — powered by the agrobr library.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

 
 
 

Contributors

Languages