Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File [geojson file] may be corrupt #97

Closed
raffaem opened this issue Oct 2, 2024 · 2 comments
Closed

File [geojson file] may be corrupt #97

raffaem opened this issue Oct 2, 2024 · 2 comments
Labels
not-downloading Data is not downloaded from the server

Comments

@raffaem
Copy link

raffaem commented Oct 2, 2024

When I try to set cache=FALSE, it tells me that the file on the remote server may be corrupted:

> geodata <- get_eurostat_geospatial(nuts_level = 2, year = 2021, cache=FALSE)
Extracting data using giscoR package, please report issues on https://github.com/rOpenGov/giscoR/issues
Cache management as per giscoR. see 'giscoR::gisco_get_nuts()'
File :
https://gisco-services.ec.europa.eu/distribution/v2/nuts/geojson/NUTS_RG_60M_2021_4326_LEVL_2.geojson
may be corrupt. Please try again using cache = TRUE and update_cache = TRUE
Error: 
Execution halted
@raffaem raffaem changed the title File corrupted File [geojson file] may be corrupt Oct 2, 2024
@raffaem
Copy link
Author

raffaem commented Oct 2, 2024

By

  1. Using the github version of giscoR
  2. Manually downloading the geojson files
  3. Into the folder set by giscoR::gisco_set_cache_dir(cachedir)
  4. Using the cache = TRUE argument of eurostat::get_eurostat_geospatial

I was able to let it work.

But still it is not able to download the geojson files by itself.

@dieghernan
Copy link
Member

It should be working again:

geodata <- eurostat::get_eurostat_geospatial(nuts_level = 2, year = 2021, 
                                             cache=FALSE, verbose = TRUE, 
                                             cache_dir = tempdir())
#> Loading required namespace: sf
#> Loading required namespace: giscoR
#> Extracting data using giscoR package, please report issues on https://github.com/rOpenGov/giscoR/issues
#> Reading from url  https://gisco-services.ec.europa.eu/distribution/v2/nuts/geojson/NUTS_RG_60M_2021_4326_LEVL_2.geojson
#> File loaded 
#>  Encoding characters

geodata
#> Simple feature collection with 334 features and 11 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -61.84073 ymin: -21.37565 xmax: 55.84983 ymax: 80.79911
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>      id LEVL_CODE NUTS_ID CNTR_CODE             NAME_LATN             NUTS_NAME
#> 1  BE31         2    BE31        BE  Prov. Brabant Wallon  Prov. Brabant Wallon
#> 2  BE32         2    BE32        BE         Prov. Hainaut         Prov. Hainaut
#> 3  BE33         2    BE33        BE           Prov. Liège           Prov. Liège
#> 4  BE34         2    BE34        BE Prov. Luxembourg (BE) Prov. Luxembourg (BE)
#> 5  CH05         2    CH05        CH            Ostschweiz            Ostschweiz
#> 6  CH06         2    CH06        CH        Zentralschweiz        Zentralschweiz
#> 7  CH07         2    CH07        CH                Ticino                Ticino
#> 8  CY00         2    CY00        CY                Kýpros                Κύπρος
#> 9  CZ01         2    CZ01        CZ                 Praha                 Praha
#> 10 CZ02         2    CZ02        CZ         Střední Čechy         Střední Čechy
#>    MOUNT_TYPE URBN_TYPE COAST_TYPE FID  geo                       geometry
#> 1           0         0          0  NA BE31 MULTIPOLYGON (((4.597269 50...
#> 2           0         0          0  NA BE32 MULTIPOLYGON (((3.245294 50...
#> 3           0         0          0  NA BE33 MULTIPOLYGON (((5.431686 50...
#> 4           0         0          0  NA BE34 MULTIPOLYGON (((5.393235 50...
#> 5           0         0          0  NA CH05 MULTIPOLYGON (((9.55872 47....
#> 6           0         0          0  NA CH06 MULTIPOLYGON (((7.838686 47...
#> 7           0         0          0  NA CH07 MULTIPOLYGON (((8.955821 46...
#> 8           0         0          0  NA CY00 MULTIPOLYGON (((33.92986 35...
#> 9           0         0          0  NA CZ01 MULTIPOLYGON (((14.35668 49...
#> 10          0         0          0  NA CZ02 MULTIPOLYGON (((15.14677 50...

Created on 2024-12-27 with reprex v2.1.1

@dieghernan dieghernan added the not-downloading Data is not downloaded from the server label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-downloading Data is not downloaded from the server
Projects
None yet
Development

No branches or pull requests

2 participants