0

My data points are along two bus routes so I can draw out their paths using geom_path as in this image:
An example of what I have now
I would like to have the rest of the roads in the area drawn in as well in the same manner without having to make data files of coordinates for the roads and using a for loop to draw each road as an individual path. I tried using ggmap to accomplish this, but all I could manage to generate is a raster image of google maps for that area. The problem with this is I want both the roads and the data to be easily visible, and from what I have seen, overlaying a tile on a raster either doesn't work or makes the graph difficult to read. Is there any way I could overlay the road map as a geom_path on top of the data plotted as geom_tile?

One thing that I think might work is what this person did to get a map of Estonia overlaid on their temperature data: http://www.geo.ut.ee/aasa/LOOM02331/R_idw_interpolation.html

However I am not sure how I would get a shape file from google maps or some other map data source.

EDIT:
On the university website I found a GIS map of campus that I could download as a shape file, but I would still like to know if there is a better method for possible implementation outside of the university area. Also the shape file contains sidewalks which I could not remove and do not want. Here is the new map with the original estimated paths in red: an updated version of the graph with the full map

  • It's not entirely clear what you're asking. Do you have a specific programming problem, or are you after ways of plotting maps, like [`ggmap`](https://cran.r-project.org/web/packages/ggmap/ggmap.pdf), [`googleway`](https://github.com/SymbolixAU/googleway/blob/master/vignettes/googleway-vignette.Rmd#heatmap) or [`leaflet`](https://rstudio.github.io/leaflet/) – SymbolixAU Aug 05 '17 at 08:56
  • @SymbolixAU I am after a way of plotting maps, but the problem with the packages you listed is that they overlay data on a map, but I want a map overlaid on data, like what is in the graph in the edit. It could be a map package I have overlooked or a consistent source of shapfiles of road maps to use for the method I am currently using. – flamingfire123 Aug 05 '17 at 16:33
  • Ok I think I understand - maybe you're after a combination of `ggplot2` and `sf` - [like this example](http://ggplot2.tidyverse.org/reference/ggsf.html)? – SymbolixAU Aug 05 '17 at 22:40

0 Answers0