Closed RemiDumas closed 2 weeks ago
Since this morning, gisco_get_nuts(nuts_level = 3, resolution = "10") doesn't work no more
Hi,
Thanks for reporting, it seems to be a temporary issue on the server side (not much to fix on this package). Mine is working in Windows (see reprex at the end of this post).
We saw some intermmitent issues from time to time (label not-downloading) that eventually are fixed, my best advice is to set a persistent cache_dir
(see https://ropengov.github.io/giscoR/reference/gisco_set_cache_dir.html) with install = TRUE
so next time you call the function it would use the cached geojson.
library(giscoR)
test_nuts1_03 <- gisco_get_nuts(nuts_level = 1, resolution = "03",
cache_dir = tempdir())
head(test_nuts1_03)
#> Simple feature collection with 6 features and 10 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: 2.846719 ymin: 39.64579 xmax: 21.05607 ymax: 50.91189
#> Geodetic CRS: WGS 84
#> MOUNT_TYPE NAME_LATN
#> 1 0 SHQIPËRIA
#> 2 0 OSTÖSTERREICH
#> 3 0 SÜDÖSTERREICH
#> 4 0 RÉGION DE BRUXELLES-CAPITALE/BRUSSELS HOOFDSTEDELIJK GEWEST
#> 5 0 RÉGION WALLONNE
#> 6 0 WESTÖSTERREICH
#> CNTR_CODE NUTS_NAME
#> 1 AL SHQIPËRIA
#> 2 AT OSTÖSTERREICH
#> 3 AT SÜDÖSTERREICH
#> 4 BE RÉGION DE BRUXELLES-CAPITALE/BRUSSELS HOOFDSTEDELIJK GEWEST
#> 5 BE RÉGION WALLONNE
#> 6 AT WESTÖSTERREICH
#> LEVL_CODE NUTS_ID URBN_TYPE COAST_TYPE FID geo geometry
#> 1 1 AL0 0 0 AL0 AL0 MULTIPOLYGON (((19.77166 42...
#> 2 1 AT1 0 0 AT1 AT1 MULTIPOLYGON (((15.51265 48...
#> 3 1 AT2 0 0 AT2 AT2 MULTIPOLYGON (((15.85203 47...
#> 4 1 BE1 0 0 BE1 BE1 MULTIPOLYGON (((4.459209 50...
#> 5 1 BE3 0 0 BE3 BE3 MULTIPOLYGON (((5.69828 50....
#> 6 1 AT3 0 0 AT3 AT3 MULTIPOLYGON (((14.66538 48...
test_nuts3_10 <- gisco_get_nuts(nuts_level = 3, resolution = "10",
cache_dir = tempdir())
head(test_nuts3_10)
#> Simple feature collection with 6 features and 10 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: 23.96343 ymin: 42.71265 xmax: 27.01615 ymax: 44.03716
#> Geodetic CRS: WGS 84
#> MOUNT_TYPE NAME_LATN CNTR_CODE
#> 1 4 Pleven BG
#> 2 3 Lovech BG
#> 3 4 Veliko Tarnovo BG
#> 4 3 Gabrovo BG
#> 5 4 Ruse BG
#> 6 4 Razgrad BG
#> NUTS_NAME
#> 1 <U+041F><U+043B><U+0435><U+0432><U+0435><U+043D>
#> 2 <U+041B><U+043E><U+0432><U+0435><U+0447>
#> 3 <U+0412><U+0435><U+043B><U+0438><U+043A><U+043E> <U+0422><U+044A><U+0440><U+043D><U+043E><U+0432><U+043E>
#> 4 <U+0413><U+0430><U+0431><U+0440><U+043E><U+0432><U+043E>
#> 5 <U+0420><U+0443><U+0441><U+0435>
#> 6 <U+0420><U+0430><U+0437><U+0433><U+0440><U+0430><U+0434>
#> LEVL_CODE NUTS_ID URBN_TYPE COAST_TYPE FID geo
#> 1 3 BG314 2 3 BG314 BG314
#> 2 3 BG315 2 3 BG315 BG315
#> 3 3 BG321 2 3 BG321 BG321
#> 4 3 BG322 2 3 BG322 BG322
#> 5 3 BG323 2 3 BG323 BG323
#> 6 3 BG324 3 3 BG324 BG324
#> geometry
#> 1 MULTIPOLYGON (((24.50009 43...
#> 2 MULTIPOLYGON (((25.10645 43...
#> 3 MULTIPOLYGON (((25.39146 43...
#> 4 MULTIPOLYGON (((24.97323 43...
#> 5 MULTIPOLYGON (((26.16028 43...
#> 6 MULTIPOLYGON (((26.83469 43...
Created on 2024-07-04 with reprex v2.1.0
Ping @hannesaddec (GISCO)
All services are nominal. For investigation we would need the underlying error message from the URL request in R ?
Hi @hannesaddec , what I got is a Error 503 Backend fetch failed.
library(httr2)
req <- httr2::request("https://gisco-services.ec.europa.eu/distribution/v2/nuts/geojson/NUTS_RG_03M_2016_4326_LEVL_1.geojson")
resp <- req |>
req_error(is_error = \(resp) FALSE) |>
req_perform()
resp_body_string(resp)
#> [1] "<!DOCTYPE html>\n<html>\n <head>\n <title>503 Backend fetch failed</title>\n </head>\n <body>\n <h1>Error 503 Backend fetch failed</h1>\n <p>Backend fetch failed</p>\n <h3>Guru Meditation:</h3>\n <p>XID: 298292587</p>\n <hr>\n <p>Varnish cache server</p>\n </body>\n</html>\n"
<html>
<head>
<title>503 Backend fetch failed</title>
</head>
<body>
<h1>Error 503 Backend fetch failed</h1>
<p>Backend fetch failed</p>
<h3>Guru Meditation:</h3>
<p>XID: 298292587</p>
<hr>
<p>Varnish cache server</p>
</body>
</html>
Same result with curl commands, see reqbin here: https://reqbin.com/c-olhq6tjw
Created on 2024-07-05 with reprex v2.1.0
should be fixed.. next time please add IP address/time via PM
Would do, thanks
It works with resolution "10", "20" and "60".
Last week, everything were fine