geobr icon indicating copy to clipboard operation
geobr copied to clipboard

Neighborhood codes incorrect

Open Rodrigo-Fontoura opened this issue 4 years ago • 3 comments

Hi everyone!

I'm facing a little trouble when using the package geobr. I developed a R script to combine data from sidrar https://cran.r-project.org/web/packages/sidrar/sidrar.pdf with the shapefiles from the read_census_tract() function. The entire script seems look well but when i try to join both datasets using the neighborhood codes something go wrong.

Setting a specific city, Porto Alegre - RS for example (city IBGE code = 4314902) and extract data at neighborhood level, i receive about 80 unique neighborhood names e codes from sidrar and geobr packages. (It's OK! Great!)

My issue pops up when i identify that neighborhood codes doesn't match with each other. It seems weird once the sidrar is a IBGE official tool https://sidra.ibge.gov.br/pesquisa/censo-demografico/demografico-2010/sinopse

I attached a file with a little bit R code to ilustrate my problem.

Thanks a lot!!!

Exemplos R.txt

geobr data

sidrar data

Rodrigo-Fontoura avatar Jul 24 '20 12:07 Rodrigo-Fontoura

Hi Rodrigo. Thank you for your message.

I've looked into the original shape files of the census tracts and neighborhoods published by IBGE and they haven't published any update on the data. This is to say that the data sets in geobr are exactly the same as the ones available on IBGE´s ftp: ftp://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_de_setores_censitarios__divisoes_intramunicipais/censo_2010/setores_censitarios_shp

Havin said that, I noticed you opened an issue at the sidrar. Thanks. I dropped them a message as well. Let's wait to hear from them and hopefully we can sort this out soon.

rafapereirabr avatar Jul 28 '20 14:07 rafapereirabr

on a side note, please mind you that geobr also has a 'read_neighborhood() function.

So, instead of running this: poligonos <- read_census_tract(4314902)

You could run this, which will be a bit faster:

nei_br <- geobr::read_neighborhood()
nei_poa <- subset(nei_br, name_muni=='Porto Alegre')

rafapereirabr avatar Jul 28 '20 14:07 rafapereirabr

Hello Rafael!

In fact, I already thought about use the 'geobr::read_neighborhood()' function, however this function has a limited number of cities and I'm working in a project that covers all brazilian cities as possible.

Thanks for your efforts to solve this issue!

Rodrigo-Fontoura avatar Jul 28 '20 14:07 Rodrigo-Fontoura