I am quite new to using R - and i am currently trying to create an elevation diagram of a study site using the below code:
library(rnaturalearth)
library(rnaturalearthhires)
library(mapview)
library(mapedit)
library(elevatr)
library(tidyverse)
library(raster)
countries<-ne_countries(scale = 110, type = "countries", continent = NULL,
country = NULL, geounit = NULL, sovereignty = NULL,
returnclass = c("sf"))
admin<-ne_states(country = NULL, geounit = NULL, iso_a2 = NULL, spdf = NULL,
returnclass = c("sf"))
admin %>% filter(name=="Áncash") -> Áncash
countries %>% filter(name=="Peru") -> PER
mapview(Áncash) %>% editMap() -> d
poly<-d$drawn
elev1 <- get_elev_raster(poly, z = 14,clip="bbox")
When I try to run this I run into the following error message:
Listening on http://my IP:8888 # For reasons I am not releasing my IP
createTcpServer: address not available
Error in .subset2(public_bind_env, "initialize")(...) :
Failed to create server
>
> poly<-d$drawn
Error: object 'd' not found
> elev1 <- get_elev_raster(poly, z = 14,clip="bbox")
Error in if (attributes(class(locations)) %in% c("raster", "sp")) { :
argument is of length zero
There is probably something really simple I am missing, but after a couple of hours trying to do this on my own, I am at the point now of needing help!
Thanks in advance!