Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:33

    antagomir on master

    ok (compare)

  • 14:38

    pitkant on master

    Function tests pass without int… (compare)

  • 13:00

    pitkant on master

    More clean imports from functio… Example to \dontrun, avoid test… (compare)

  • 09:10

    pitkant on master

    codecov.yml to .Rbuildignore (compare)

  • 08:29

    antagomir on master

    ok (compare)

  • May 11 15:11

    antagomir on master

    ok (compare)

  • May 11 14:49

    antagomir on master

    added codecov config file (compare)

  • May 11 14:40

    antagomir on master

    ok (compare)

  • May 11 14:36

    antagomir on master

    codecov link update (compare)

  • May 11 13:13

    pitkant on master

    Small updates (compare)

  • May 10 19:48

    antagomir on master

    cran checks ok (compare)

  • May 10 15:42

    pitkant on master

    More clearly stated where funct… Edited contributors, removed un… Common items to .gitignore and 5 more (compare)

  • May 09 20:09
    antagomir commented #202
  • May 09 17:59
    retostauffer commented #202
  • May 09 10:50

    antagomir on master

    ok (compare)

  • May 09 10:48
    antagomir labeled #211
  • May 09 10:48
    antagomir opened #211
  • May 09 10:22

    antagomir on master

    added stringi back to imports (compare)

  • May 09 10:02
    antagomir commented #202
  • May 09 09:57

    antagomir on master

    Finalizing PR on #202 Testing before cran (compare)

Leo Lahti
@antagomir
Yes I thought so too.
Ok so I can tell them that this was due to historical reasons & we are just planning switch when the time allows. I may also mention that we still consider at some point having copies of the most common files in the R package in order to avoid download.
Markus Kainu
@muuankarski
That is a something worth considerinf
Joona Lehtomäki
@jlehtoma
@muuankarski could be an issue with GDAL reading TopoJSON or then something funky has been going down in producing the TopoJSON files
No personal experience on the CRSs / TopoJSON tho
But: everything seems to be in order, so carry on :)
Leo Lahti
@antagomir
il
Markus Kainu
@muuankarski

One issue still prevails, as in current implementation of get_eurostat_geospatial user can opt for SpatialPolygonDataFrame , fortified data.frame or sf output. We could provide those conversions "on-the-fly" if we will rely on the json-files from eurostat (now they come preprocessed using download.file()). If we would provide all three it would require following steps on-the-fly.

# =======================================================
# If user passes output_class = "sf" OR does not spesify it (default behaviour)
## Download and return a sf-object
# =======================================================
library(sf)
library(dplyr)
jsontemp <- tempfile()
download.file("http://ec.europa.eu/eurostat/cache/GISCO/distribution/v1/geojson/nuts-2013/NUTS_RG_60M_2013_4258_LEVL_0.geojson",
              jsontemp)
shape <- sf::st_read(jsontemp, stringsAsFactors = FALSE)
return(shape)

# =======================================================
# If user passes output_class = "sp" this is done in addition to default behaviour
## Convert sf-object into sp-object SpatialPolygonDataFrame
# =======================================================
shape_sp <- as(shape, "Spatial")
return(shape_sp)

# =======================================================
# If user passes output_class = "data.frame" this is done in addition to steps above
## Convert SpatialPolygonDataFrame into "fortified" regular data.frame to be plotted with ggplot2::geom_polygon
# =======================================================
shape_sp$id <- row.names(shape_sp)
fortified <- broom::tidy(shape_sp)
fortified <- left_join(fortified,shape_sp@data)
return(fortified)

@jlehtoma what do you think, is that feasible to do on-the-fly OR should we provide just a sf-output and nothing else..?

Leo Lahti
@antagomir
sf could be default and others optional ?
Markus Kainu
@muuankarski

Yep, that is the current behavior (in sf-branch), but providing the other options would require adding broom-dependency at least.

I could try with preserving the exact same behavior as currently, but change the source and processing. A new attribute would be nuts_level where user could pass either 0,1,2,3 or all. all would be default allowing the current behavior of subsetting with inner_join only.

Leo Lahti
@antagomir
Sound very good to me. I think we can import one more package but it is true that we are starting to have quite many imported packages. Could investigate at some point if these can be reduced.. or splitting data retrieval and geovisualization components in separate packages is also an option (though perhaps a bit complicated one)
Markus Kainu
@muuankarski
rOpenGov/eurostat@57d1686
now the basic idea is implemented. At least, cache needs to be revised. Can test with:
library(eurostat)
library(dplyr)
library(sf)
# sf
shape_sf <- get_eurostat_geospatial(nuts_level = "0", output_class = "sf")
shape_sf %>% select(NUTS_ID) %>% plot()
# data.frame
shape_df <- get_eurostat_geospatial(nuts_level = "0", output_class = "df")
shape_df %>% ggplot2::ggplot(.) + ggplot2::geom_polygon(aes(x=long,y=lat,group=group,fill=NUTS_ID))
# spdf
shape_spdf <- get_eurostat_geospatial(nuts_level = "0", output_class = "spdf")
sp::spplot(obj = shape_spdf, "NUTS_ID")
Leo Lahti
@antagomir
is this in master now ?
Markus Kainu
@muuankarski
no no, in simplefeatures branch
Leo Lahti
@antagomir
yees
i saw wrong
Markus Kainu
@muuankarski
i double checked..
Leo Lahti
@antagomir
yes it works ! (after adding library(ggplot2) in the beginning)
Markus Kainu
@muuankarski
\o/
Perhaps there is a better method for fetching this json data http://ec.europa.eu/eurostat/cache/GISCO/distribution/v1/geojson/nuts-2013/NUTS_RG_60M_2013_4258_LEVL_3.geojson than download.file()...
Leo Lahti
@antagomir
might be
Markus Kainu
@muuankarski
instead of download.file() I implemented it using httr::GETnow, the two options are listed below:
resolution <- "60"
# option 1
resp <- httr::GET(paste0("http://ec.europa.eu/eurostat/cache/GISCO/distribution/v1/geojson/nuts-2013/NUTS_RG_",resolution,"M_2013_4258_LEVL_1.geojson"))
nuts1 <- sf::st_read(httr::content(resp, as="text"), stringsAsFactors = FALSE)
# option 2
jsontemp <- tempfile()
download.file(paste0("http://ec.europa.eu/eurostat/cache/GISCO/distribution/v1/geojson/nuts-2013/NUTS_RG_",resolution,"M_2013_4258_LEVL_1.geojson"), jsontemp)
nuts1 <- sf::st_read(jsontemp, stringsAsFactors = FALSE)
Leo Lahti
@antagomir
you are a piece of gold
Markus Kainu
@muuankarski
I had a similar feeling for a second! Now have to hurry back to normal life and being a piece of shit!
Leo Lahti
@antagomir
!
Markus Kainu
@muuankarski
rOpenGov/eurostat@ff6defa here is the fix. Commits do show up nicely in the right side listing ->
Leo Lahti
@antagomir
nicee
Joona Lehtomäki
@jlehtoma
Very nice!
Leo Lahti
@antagomir
FedData package has functionality to download GIS data in US: https://ropensci.org/blog/technotes/2017/08/24/FedData-release
Joona Lehtomäki
@jlehtoma
Was just linking the same here, seems worth exploring
Leo Lahti
@antagomir
!