After a bit of research, I think this error might be caused by the length of the polygon string that I'm sending to NBN using specieslist()
. For example, a simple rectangle can be defined like this:
library(NBN4R)
ext_rectangle<-"POLYGON ((-1.378784 52.09807, -1.378784 52.25807, -1.172791 52.25807, -1.172791 52.09807, -1.378784 52.09807))"
rectangle_test<-specieslist(wkt = ext_rectangle)
library(NBN4R)
library(sf)
library(raster)
coords<-as.numeric(c("-0.406494", "51.998410"))
pt <- SpatialPointsDataFrame(data.frame(coords[1], coords[2]), data = data.frame('Pt1'), proj4string = CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"))
poly<-st_as_sf(buffer(pt, width = 2000)) # Puts 2km circular buffer around point
ext_circular<-st_as_text(poly$geometry) # Creates a WKT string for specieslist() function
circle_test<-specieslist(wkt = ext_circular)
Error in check_status_code(status_code, on_redirect = on_redirect, on_client_error = on_client_error, :
HTTP status code 414 received.
Either there was an error with your request or in the NBN4R package, or the servers are down. If this problem persists please notify the NBN4R maintainers by lodging an issue at NBN4R github repo or emailing [email protected]
In addition: Warning messages:
1: In cached_get(url = this_url, type = "filename") :
URL length may be longer than is allowed by the server
2: In download_to_file(url, outfile = this_outfile, binary_file = identical(type, :
URL length may be longer than is allowed by the server
My question, therefore, is whether there is an easier way of defining a circular buffer around a point, which I can convert to WKT so that specieslist()
can function? Is this possible?
Thanks in advance.