I'm trying to create a GeoTiff from a leaflet map. I've tried to find answers to this online but non of them seem to work for me. I'm quite new with using R. The geodata is a 2000*10 matrix where the title, long and latitude is found. Here is my code:
install.packages('leaflet')
install.packages('rgdal')
install.packages('raster')
install.packages('sp')
library(leaflet)
library(raster)
library(rgdal)
library(raster)
library(sp)
sites <- data.frame(Name=(geodata[,2]),Long=(geodata[,10]),Lati=(geodata[,9]))
ma <- leaflet()
ma <- addTiles(ma)
ma <- addMarkers(ma, lng=sites$Long, lat=sites$Lati, popup=sites$Name)
ma
rast <- writeRaster(ma, filename="Worldmap.tif", format="GTiff")
It is the last step "writeRaster" that is not working. The error message that I get looks like this :
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function 'writeRaster'
for signature '"leaflet", "character"'
Any idea of where the error might be?