Learn R Programming

⚠️There's a newer version (1.9.1) of this package.Take me there.

geobr

geobr is an R package that allows users to easily access shapefiles of the Brazilian Institute of Geography and Statistics (IBGE) and other official spatial data sets of Brazil. The package includes a wide range of geographic datasets as simple features, availabe at various geographic scales and for various years (see detailed list below):

Installation

devtools::install_github("ipeaGIT/geobr")
library(geobr)

Basic Usage

# Read specific municipality at a given year
  mun <- read_municipality(code_muni=1200179, year=2017)
  
  
# Read all municipalities of a state at a given year
  mun <- read_municipality(code_muni=33, year=2010)
  # alternatively
  mun <- read_municipality(code_muni="RJ", year=2010)

# Read all municipalities in the country at a given year
  mun <- read_municipality(code_muni="all", year=2018)

Available datasets:

FunctionGeographies availableYears availableSource
read_countryCountry2010, 2013, 2014, 2015, 2016, 2017, 2018IBGE
read_regionRegion2000, 2001, 2010, 2013, 2014, 2015, 2016, 2017, 2018IBGE
read_stateStates1872, 1900, 1911, 1920, 1933, 1940, 1950, 1960, 1970, 1980, 1991, 2000, 2001, 2010, 2013, 2014, 2015, 2016, 2017, 2018IBGE
read_meso_regionMeso region2000, 2001, 2010, 2013, 2014, 2015, 2016, 2017, 2018IBGE
read_micro_regionMicro region2000, 2001, 2010, 2013, 2014, 2015, 2016, 2017, 2018IBGE
read_municipalityMunicipality1872, 1900, 1911, 1920, 1933, 1940, 1950, 1960, 1970, 1980, 1991, 2000, 2001, 2005, 2007, 2010, 2013, 2014, 2015, 2016, 2017, 2018IBGE
read_weighting_areaCensus weighting area (área de ponderação)2000IBGE
read_statistical_gridStatistical Grid of 200 x 200 meters2010IBGE
read_health_facilitiesHealth facilities2015CNES, DataSUS

obs. Geodetic reference system "SIRGAS2000", CRS(4674). Most data setsare available at scale 1:250,000 (see documentation for details).

Comming soon:

GeographyYears availableSource
read_census_tract2000, 2007, 2010IBGE
Metropolitan areas...IBGE and state legislations
Longitudinal Database* of municipalities...IBGE
Longitudinal Database* of micro regions...IBGE
Longitudinal Database* of Census tracts...IBGE
Urbanized areas2005, 2015IBGE
Disaster risk areas2010IBGE/Cemaden
.........
.........

'*' Longitudinal Database refers to áreas mínimas comparáveis (AMCs)

Credits

The shape files are created by IBGE. The geobr package is developed by a team at the Institute for Applied Economic Research (Ipea), Brazil. If you want to cite this package, you can cite it as:

  • Pereira, R.H.M.; Gonçalves, C.N.; Araujo, P.H.F. de; Carvalho, G.D.; Nascimento, I.; Arruda, R.A. de. (2019) geobr: an R package to easily access shapefiles of the Brazilian Institute of Geography and Statistics. GitHub repository - https://github.com/ipeaGIT/geobr.

Advantages of geobr and related projects

As of today, there are two other R packges with similar functionalities. These are the packages simplefeaturesbr and brazilmaps. The geobr package follows an intuitive syntax and it has a few advantages when compared to other packages, including for example:

  • Access to a wider range of official spatial data sets, such as states and municipalities, but also macro-, meso- and micro-regions, weighting areas, census tracts, urbanized areas, etc
  • Access to shape files with updated geometries for various years
  • Harmonized attributes and geographic projections across geographies and years

Copy Link

Version

Install

install.packages('geobr')

Monthly Downloads

3,708

Version

0.02

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Rafael H. M. Pereira

Last Published

September 6th, 2024

Functions in geobr (0.02)

read_municipality

Download shape files of Brazilian municipalities as sf objects. Data at scale 1:250,000, using Geodetic reference system "SIRGAS2000" and CRS(4674)
read_state

Download shape files of Brazilian states as sf objects. Data at scale 1:250,000, using Geodetic reference system "SIRGAS2000" and CRS(4674)
read_statistical_grid

Download shape files of IBGE's statistical grid (200 x 200 meters) as sf objects. Data at scale 1:250,000, using Geodetic reference system "SIRGAS2000" and CRS(4674)
read_weighting_area

Download shape files of Census Weighting Areas (area de ponderacao) of the Brazilian Population Census. Only 2010 data is currently available.
brazil_2010

Spatial dataset sf with codes for Brazilian municipalities in 2010
read_census_tract

Download shape files of census sectors of the Brazilian Population Census
read_meso_region

Download shape files of meso region as sf objects. Data at scale 1:250,000, using Geodetic reference system "SIRGAS2000" and CRS(4674)
read_micro_region

Download shape files of micro region as sf objects. Data at scale 1:250,000, using Geodetic reference system "SIRGAS2000" and CRS(4674)
read_region

Download shape file of Brazil Regions as sf objects. Data at scale 1:250,000, using Geodetic reference system "SIRGAS2000" and CRS(4674)
read_country

Download shape file of Brazil as sf objects. Data at scale 1:250,000, using Geodetic reference system "SIRGAS2000" and CRS(4674)
read_health_facilities

Download geolocated data of health facilities as an sf object.