I've been reading through the documentation, but not getting anywhere with this question.
I have a data frame with three columns. The first two are gps coordinates, [such as 42.06, -70.19 for (Provincetown, Massachusetts, USA)], and the third column is a value for each of those coordinates.
That data frame is called forRaster
Here's what I have so far:
library(raster)
library(leaflet)
library(rgdal)
needsRaster = rasterFromXYZ(forRaster)
plot(needsRaster)
needsImage = image(needsRaster)
needsLeafletRaster = projectRasterForLeaflet(needsImage)
needsMap = leaflet()
addRasterImage(needsMap, needsLeafletRaster)
needsMap
But I keep getting this error after the projectRasterForLeaflet
call:
Error in raster::projectRaster(x, raster::projectExtent(x, crs = sp::CRS(epsg3857))) :
input projection is NA
I find the leaflet documentation not entirely straightforward, and am wondering if anyone cal help. If I need to make the raster differently in any way, I'm happy to do so. Thanks.