ipeagit / geobr Goto Github PK
View Code? Open in Web Editor NEWEasy access to official spatial data sets of Brazil in R and Python
Home Page: https://ipeagit.github.io/geobr/
Easy access to official spatial data sets of Brazil in R and Python
Home Page: https://ipeagit.github.io/geobr/
para carregar base, basta rodar data("brazil_2010").
Depois é necessário fazer um dissolve da base de acordo com a geografia em cada função
There's a typo in the README.md file. Coming soon , not Comming soon. :)
Paulo, alterar o nome das colunas para seguir padrão do pacote. Isso precisa ser alterado tanto no script da função quanto na base de dados
nome das cols atualmente: cod_areapond
, cod_mum
, cod_uf
como deve ficar: code_weighting_area
, code_muni
, code_state
Colocar todas bases de município com mesma estrutura de arquivo. Exemplo:
nome_mun cod_mun geometry
1 Acrelândia 1200013 POLYGON ((-67.13424 -9.6762...
2 Assis Brasil 1200054 POLYGON ((-69.5814 -10.3806...
...
personal opinion here: I don't like to have to tell the function which subset of the data I want. The natural expectation is that you will get all the data. Making code_muni="all" the default would avoid this.
I think having this default at least for the small datasets (mun, uf, micro, macro) makes sense.
Far large dataset such as setor censitario, faces, etc. than you could force user to define *_muni="all"
Source: Atlas do Desenvolvimento, do Ipea
Passar para pasta ./geobr/prep_data
os scripts em R que foram usados para tratamento dos dados brutos. Isso serve para fins de documentação
It would be interesting if the function (or functions) implemented to solve #38, #39, and #45 allows the user to choose what to do with municipalities that are not fully within the region. Some possibilities:
Create one or two vignettes demonstrating the package functions
Brazilian Central bank updates on a monthly basis a database with addresses of all bank branches in Brazil.
There is a database for branches, PAE, PAB (these two are smaller branches, usually inside large companies) and consórcio administrator.
Link is below
https://www.bcb.gov.br/estabilidadefinanceira/agenciasconsorcio
Do you really need the files at: /geobr/data/*
?
It seems this makes the package much larger than necessary (I assume because brazil_2010 is a geometry right?) in terms of size.
@rafapereirabr , I imagine that you created ipeaGIT because the ipea (https://github.com/ipea) group name was taken.
But it is actually ours, and I just added you as owner.
Consider migrating the project there if you want.
Create script prep_urban_areas
do download and clan IBGE data on urbanized areas (years 2005 and 2015)
Create geobr
function read_urban_area()
to download the data
obs. data available at ftp://geoftp.ibge.gov.br/organizacao_do_territorio/tipologias_do_territorio/areas_urbanizadas_do_brasil
Criar função que varre todos arquivos na pasta ./geobr/data
e atualiza tabela com metadados do pacote. Exemplo abaixo de tabela de metadados
geo | year | code | download_path |
---|---|---|---|
municipio | 2001 | 33 | http://www.ipea.gov.br/geobr/municipio/2001/33MU.rds |
micro_regiao | 2016 | 17 | http://www.ipea.gov.br/geobr/micro_regiao/2016/17MI.rds |
... | ... | ... | ... |
read_grade( cod_uf = xxxxx, cod_muni = xxxxx, year = 2010) {
# read sf municipality
temp_muni <- read_muni(cod_muni = xxxxx, year = 2010)
# read bbox das grades do brasil (PRECISA SER CRIADO)
# overlay muni and grade bboxes
# identify grade id
# fazer download do grade ID do muni.ZIP
# Unzipar grade ID do muni
# ler grade ID do muni
# crop do muni sf e grade_id
}
e ai @rafapereirabr ! Ta ficando legal!!
Minor suggestion: add UF name to municipalities dataset.
Sometimes the person will only have UF names and Municipality names (as in my case now with the Brasil Mais Produtivo data). And municipal names are not unique, only within State.
Geographic names that contain accents seem to cause warnings when I use the read_ function in a US English enviroment. See attached pdf for an example.
Adding a line
options(encoding='UTF-8')
did not change anything.
geobr-test.pdf
data: ftp://geoftp.ibge.gov.br/recortes_para_fins_estatisticos/malha_de_setores_censitarios/censo_2010/base_de_faces_de_logradouros/
info:
ftp://geoftp.ibge.gov.br/recortes_para_fins_estatisticos/malha_de_setores_censitarios/censo_2010/base_de_faces_de_logradouros/1_Leia_me/Base%20de%20Faces%20de%20Logradouros%20do%20CD%202010.pdf
Pessoal, por favor se certifiquem de que estamos a sintaxe package::function()
para todas funções no pacote.
read_country() with no arguments returns the geometry of Brazil in 2010 with several holes. The data for 2014 and 2015 also have some holes. Perhaps removing the holes manually after computing the union solves the problem as shown in the code below.
(I saw in another issue the discussion that st_union is very slow. unionSpatialPolygons from maptools is much faster)
require(geobr)
require(dplyr)
require(sp)
require(sf)
require(maptools)
sp_states <- read_state(year=2010, code_state = "all") %>% as("Spatial")
result <- unionSpatialPolygons(sp_states, rep(TRUE, 27))
outerRings = Filter(function(f){f@ringDir==1},result@polygons[[1]]@Polygons)
outerBounds = SpatialPolygons(list(Polygons(outerRings,ID=1)))
plot(outerBounds)
m <- st_as_sf(outerBounds)
write_sf(m, "brazil.shp")
Include table with metadata of all geometries ./data
. Something like:
municipality_name | municipality_code | state_name | state_code | region_name | state_initials | region_code | geom |
---|---|---|---|---|---|---|---|
... | ... | ... | ... | ... | ... | ... | ... |
geom
informar dados referentes aos municipiosincluir opção de ler a sigla do estado, exemplo m <- read_uf(cod_uf="SP", ano=2010)
Is there any work/planning to build a python version?
If not, can I start one? There is no licensing on the project. So I am not sure about if you are ok with other users building on your .rds files.
historical data on municipios_1872_1991 can be found at this address ftp://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais
usar nomes:
[1] "cod_muni" "name_muni" "cod_micro" "name_micro" "cod_meso" "name_meso" "cod_state"
[8] "name_state" "abbrev_state" "cod_region" "name_region" "geometry"
```
test <- read_weighting_area(code_weighting = 35, year=2010)
test <- read_weighting_area(code_weighting = "SP", year=2010)
Os códigos acima retornam "Error in parse_url(url) : length(url) == 1 is not TRUE".
Estou entrando algo errado, ou a função está com problemas?
Igor, eu sugiro mover a vignette 2 de Georeferencing-gain
para outro branch do repositório, e trazer ela para o main branch quando tivermos artigo em estágio mais avançado. Assim ela nao entra na submissão versão 1.0 do pacote para o CRAN. O que acha?
O manual.pdf diz read_uf, mas no pacote a função que faz tal operação parece ser a read_state.
dasdasdasd
Avaliar se é possível aproveitar o código em Stata do Philipp Ehrl (professor da Univ. Catolica de Brasilia e bolsista na DIRUR). Ele publicou uma nota na Estudos Economicos sobre o código e o código está disponível aqui.
Function calls such as:
states <- read_state(year=2010, code_state = "all")
create one progress bar each time a state will be donloaded, summing up 27 progress bars in this case. Possibly creating one single progress bar that grows as each state is downloaded would be more interesting for the user.
when I choose a single UF, like cod_micro = 24 , the read_micro_region function returns the right geometries, but it does not retain the full microregion codes. Instead they are all "24".
That will be a serious problem if a user later wants to merge microregion data (employment rates, % rural population, ...) from some other source onto this dataframe.
Colocar todas bases de área de ponderação com mesma estrutura de arquivo.
colunas cod_areapond
, cod_mun
e geom
Adicionar função read_country
. Que envolve
# 1 carregar dados dos estados
read_state(cod_state="all")
# Dar merge nos poligonos. Um das funções abaixo:
st_union
st_combine
Sugestão do @pedro-andrade-inpe
para carregar base, basta rodar data("brazil_2010")
e retornar a return(brazil_2010)
Add the followig two columns to UF data sets
"region_name", "region_code"
North, 1
South, 4
..., ...
for future consideration: add a read_terras_indigenas function that grabs polygons from FUNAI
Oi Guilherme, use aqueles shape files de áreas de risco do IBGE que usamos no outro trabalho do ODS. Ok? abs
Include cod_uf
argument in the read_municipio
function
Example:
read_municipio(cod_uf="SP", ano=2010)
returns all municipalities of UF 35
A call to read_biomes()
without any argument does not work as it requires an year. It could work even without any argument by having 2004 as default value. I don't know whether the other read
functions have a default year, but I think they could always return the latest data available when the year
argument is not used.
data available here: https://concla.ibge.gov.br/classificacoes/por-tema/codigo-de-areas/codigo-de-areas
Colocar todas bases de mesoregiões com mesma estrutura de arquivo. Exemplo:
nome_meso cod_meso Geometry
1 Leste Rondoniense 1102 POLYGON ((-62.22055 -8.5908...
2 Madeira-Guaporé 1101 POLYGON ((-63.32721 -7.9767...
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.