maczokni / crimemapping_textbook_bookdown

Workbook for crime mapping course
Creative Commons Zero v1.0 Universal
29 stars 6 forks source link

annotation_map_tile() in end of week 10 isn't working with stat_binhex() #3

Closed maczokni closed 5 years ago

maczokni commented 5 years ago

I thought it would be an easy fix to use annotation_map_tile() for basemap for the hexbinning exercise instead of ggmap() but it seems to not communicate coordinates.

I've tried: coord_cartesian() and coord_equal() converting to SpatialPointsDataframe adding a sf polygon to bind it

No success.... any ideas?

OR we could try to export the hex from ggplot as a raster, and add to leaflet, like we do with the KDE map in Week 5?

maczokni commented 5 years ago

Fixed this, in case of interest to note, I had to pass the correctly projected spatial df in the leaflet() argument, rather than in the bin layer, because annotation_map_tile() inherits the projection from there.