Closed NilsDroste closed 3 years ago
Hi @NilsDroste. I believe our server is a bit unstable at the moment. Could you please restart you R session and try it again in an hour or so?
Olá @rafapereirabr , estou com o mesmo problema citado por NilsDroste
Olhando mais a fundo, fiz o código para ver se havia algum problema com um estado específico
No resultado de temp_sf
vem uma lista, onde o índice que estiver NULL representa o estado com problema
Adicionei um Sys.sleep()
entre o download de um estado e outro, para garantir não sobrecarregar o servidor
library(tidyverse)
temp_meta <- geobr::select_metadata(
geography = "state",
year = 2020,
simplified = FALSE
)
file_url <- temp_meta$download_path
download_gpkg_sleep <- function(url){
dados <- geobr::download_gpkg(file_url = url,progress_bar = TRUE)
Sys.sleep(3)
return(dados)
}
maybe <- purrr::possibly(download_gpkg_sleep,otherwise = NULL)
temp_sf <- file_url %>%
purrr::map(.,maybe)
Rodei algumas vezes, para ver se o erro vem sempre no mesmo estado, porém não é o que acontece, a cada vez, da problema em um estado diferente
Realmente deve ser problema no servidor dos arquivos, e como sempre vem algum dos estados com problema, da pau na hora de consolidar o arquivo final da saída da função
Dados esse problema, um possível esquema de solução para ser incorporado na função do pacote
library(tidyverse)
# Baixa os metadados
temp_meta <- select_metadata(
geography = "state",
year = 2020,
simplified = FALSE
)
# Baixa os links dos estados
file_url <- temp_meta$download_path
# Deixa a função de download flexível ao erro
maybe_download <- purrr::possibly(geobr::download_gpkg,otherwise = NULL)
# Função para download, caso de erro, continua tentando ate funcionar
download_gpkg_2 <- function(url){
dados <- NULL
while(is.null(dados)){
dados <- maybe_download(file_url = url,progress_bar = TRUE)
}
return(dados)
}
# Baixa todos os estados
temp_sf <- file_url %>%
purrr::map(.,download_gpkg_2)
# Cria o arquivo final
estados <- dplyr::bind_rows(temp_sf)
Desse jeito, quando a função geobr::download_gpkg
der problema devido ao servidor dos arquivos, retornará NULL
, e tentará baixar outra vez o mesmo estado
Thank you for your suggesiton, @henrique1008. This might help, but it does not entirely solve the problem, which seems to involve making changes to Ipea's server infrastructure. I'm checking this with our IT team. I'll keep you posted here.
Hi all. We've mande some changes to our servers and this problem seems to be fixed now. Thank you for the heads up! Closing this issue for now, but please let us know if you encounter this problem again.
Hey team, I've been receiving the message: " 'temp.gpkg' not recognized as a supported file format" when using the following code: census = read_census_tract(code_tract="all", year=2020)
. Am I missing something?
Hi @rzendonadi . It seems be working fine on the other machines I've tried on now. Please restart your R session and try again. Let me know if it works
Hey, @rafapereirabr. Apparently only for the state of Amapá returns that message when using this python code: geobr.read_census_tract(code_tract = 'AP', year=2020, zone="urban")
. All the other states that I've tried are running well. Can you double check, please?
I just checked and the data file itself is fine. Could you try the code without the zone="urban"
bit? This parameter is only really necessary when year=2000
.
geobr.read_census_tract(code_tract = 'AP', year=2020)
Estou tendo o mesmo problema aqui, como mostra a figura seguinte. Tentei rodar algumas vezes 3 dias atrás e agora mais algumas vezes, em outro computador, dando sempre esse mesmo problema. Até tentei mudar o ano do layer, mas não adiantou
Oi @matheushenriquebarboza . O codigo roda normalmente aqui. Isso pode ocorrer se houve algum problema de conexão durante o download e o arquivo baixado ficou corrompido. Nesse caso, sugiro reiniciar a sessão do R e tentar o download novamente.
df <- geobr::read_census_tract(code_tract = 3550308, year = 2000)
head(df)
currently, there seems to be an issue with the one of the downloaded gpkg as
geobr::read_municipality()
fails to read.Steps to reproduce:
muns <- geobr::read_municipality(code_muni="all", simplified = F, year=2020)
Error: Cannot open "..\Temp\RtmpsBQxDW\21MU.gpkg"; The source could be corrupt or not supported. See
st_drivers()
for a list of supported formats.sf::st_drivers()
does indicate the existence of a corresponding driver