Geovisualization with spatial tiles - COVID19 Research

Names: Dario Bonaretti
From: Nova Southeaster University / University of Pavia

I'm working with facebook data—they are providing a lot of data summarized by tile/quadkeys so I believe this will be help many others.

I can plot tiles in ggplot using tile coordinates, but I struggle to add a map layer, or to map raster tiles to the fill of geom_tiles.

I know there are solutions there like ggmap. But I'm looking for an approach that would allow selecting specific tiles and then plot map/geographical references underneath.

Is the data publicly available? I might be able to help you if I had a sample of the data, but I can't figure it just from your description (I am a man of next to zero imagination).

In general {ggplot2} has the benefit of being familiar to just about every R user, but it sort of struggles with displaying rasters; in this area {tmap} often delivers better. If interactivity is desired, especially in combination with a basemap layer, it is hard to beat {leaflet} and friends.

1 Like

@jlacko thanks for your answer. Here are some more details about my query. The dataset I have looks like the below (I've derived x_tile and y_tile, hopefully, that's correct)

# A tibble: 3 x 4
  quadkey           n_crisis x_tile y_tile
  <chr>               <dbl>  <dbl>  <dbl>
1 1202213332331033     12.8  34747  23539
2 1202213332320210     23.5  34722  23540
3 1202213332301322     32.0  34732  23527

structure(list(quadkey = c("1202213332331033", "1202213332320210", 
"1202213332301322"), n_crisis = c(12.8498852593168, 23.5134709422016, 
32.0378628372822), x_tile = c(34747, 34722, 34732), y_tile = c(23539, 
23540, 23527)), class = c("spec_tbl_df", "tbl_df", "tbl", "data.frame"
), row.names = c(NA, -3L))

I'm trying to plot those tiles on a map. With ggplot2, I can plot the tiles but I'm not sure how to add the map. With leaflet, I'm not sure how to add tiles on a map. Any input on that?

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.