rOpenGov / eurostat

R tools for Eurostat data
http://ropengov.github.io/eurostat
Other
235 stars 46 forks source link

NUTS 2006 in get_eurostat_geospatial #112

Closed muuankarski closed 6 years ago

muuankarski commented 6 years ago

I am wondering if it's possible to use the NUTS 2006 geospatial file within get_eurostat_geospatial. The reason I ask is that I am trying to map some statistics from earlier years, based on NUTS 2006.

muuankarski commented 6 years ago

NUTS releases 2003, 2006, 2010 and 2013 are now all available with get_eurostat_geodata() using new year argument with https://github.com/rOpenGov/eurostat/commit/84f34abd923efb8fb1b5b29bfbbb95194b8d06b3

An example at country level:

library(dplyr)
library(sf)
l013 <- eurostat::get_eurostat_geospatial(resolution = 20, nuts_level = "0", output_class = "sf", year = 2013) %>% 
  mutate(year = 2013)
l010 <- eurostat::get_eurostat_geospatial(resolution = 20, nuts_level = "0", output_class = "sf", year = 2010) %>% 
  mutate(year = 2010)
l006 <- eurostat::get_eurostat_geospatial(resolution = 20, nuts_level = "0", output_class = "sf", year = 2006) %>% 
  mutate(year = 2006)
l003 <- eurostat::get_eurostat_geospatial(resolution = 20, nuts_level = "0", output_class = "sf", year = 2003) %>% 
  mutate(year = 2003)

dat <- rbind(l013,l010,l006,l003)

# devtools::install_github("tidyverse/ggplot2")
library(ggplot2)
ggplot(dat) +
  geom_sf(aes(fill = geo)) + facet_wrap(~year) +
  theme_light() + theme(legend.position="none") +
  coord_sf(xlim=c(-12,44), ylim=c(35,70))

plot

mschnetzer commented 6 years ago

Hi, thanks for these examples. For me, all resolutions apart from 1:60M are not working.

> eurostat::get_eurostat_geospatial(resolution = 20, nuts_level = "0", output_class = "sf", year = 2013)

COPYRIGHT NOTICE

When data downloaded from this page 
<http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units>
is used in any printed or electronic publication, 
in addition to any other provisions 
applicable to the whole Eurostat website, 
data source will have to be acknowledged 
in the legend of the map and 
in the introductory page of the publication 
with the following copyright notice:

- EN: (C) EuroGeographics for the administrative boundaries
- FR: (C) EuroGeographics pour les limites administratives
- DE: (C) EuroGeographics bezuglich der Verwaltungsgrenzen

For publications in languages other than 
English, French or German, 
the translation of the copyright notice 
in the language of the publication shall be used.

If you intend to use the data commercially, 
please contact EuroGeographics for 
information regarding their licence agreements.

Cannot open data source <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /site5/cache/GISCO/distribution/v1/geojson/NUTS_RG_20M_2013_4258_LEVL_0.geojson was not found on this server.</p>
</body></html>

Fehler in CPL_read_ogr(dsn, layer, as.character(options), quiet, type,  : 
  Open failed.
muuankarski commented 6 years ago

Apologies for delay, the path to GISCO api had been changed. Fixed with https://github.com/rOpenGov/eurostat/commit/ee93dfe5262a2daef545d9cf7cae71ce134b1a30 - please install the latest from Github and test!

mschnetzer commented 6 years ago

Works great now, thanks a lot!!