-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
Não é possível baixar as geometrias/shapes por trás de proxy.
Ao debugar o código fica evidente que o problema está na chamada de curl::has_internet().
No stackoverflow foi possível encontrar uma gambiarra para resolver o problema.
https://stackoverflow.com/a/59800411
Segue reprex mostrando há o problema com proxy e a alternativa fornecida ainda funciona.
Não sei qual seria a melhor forma de contornar o problema. Imagino que uma alternativa seja oferecer uma mensagem mais informativa, talvez apontando para essa issue. Como a solução depende de uma escolha de política do código, não vou oferecer pull request. Caso uma caminho seja apontado, posso oferecer uma sugestão de código.
library(geobr)
#> Warning: pacote 'geobr' foi compilado no R versão 4.4.3
#> Carregando namespace exigido: sf
uf <- read_state()
#> No internet connection.
curl::has_internet()
#> [1] FALSE
# Source - https://stackoverflow.com/a
# Posted by Hong Ooi
# Retrieved 2025-11-11, License - CC BY-SA 4.0
assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
curl::has_internet()
#> [1] TRUE
uf <- read_state()
#> Using year/date 2010
uf
#> Simple feature collection with 27 features and 5 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: -73.99045 ymin: -33.75208 xmax: -28.83594 ymax: 5.271841
#> Geodetic CRS: SIRGAS 2000
#> First 10 features:
#> code_state abbrev_state name_state code_region name_region
#> 1 11 RO Rondônia 1 Norte
#> 2 12 AC Acre 1 Norte
#> 3 13 AM Amazonas 1 Norte
#> 4 14 RR Roraima 1 Norte
#> 5 15 PA Pará 1 Norte
#> 6 16 AP Amapá 1 Norte
#> 7 17 TO Tocantins 1 Norte
#> 8 21 MA Maranhão 2 Nordeste
#> 9 22 PI Piauí 2 Nordeste
#> 10 23 CE Ceará 2 Nordeste
#> geom
#> 1 MULTIPOLYGON (((-63.32721 -...
#> 2 MULTIPOLYGON (((-73.18253 -...
#> 3 MULTIPOLYGON (((-67.32609 2...
#> 4 MULTIPOLYGON (((-60.20051 5...
#> 5 MULTIPOLYGON (((-54.95431 2...
#> 6 MULTIPOLYGON (((-51.1797 4....
#> 7 MULTIPOLYGON (((-48.35878 -...
#> 8 MULTIPOLYGON (((-45.84073 -...
#> 9 MULTIPOLYGON (((-41.74605 -...
#> 10 MULTIPOLYGON (((-41.16703 -...Created on 2025-11-11 with reprex v2.1.1
Metadata
Metadata
Assignees
Labels
No labels