YuriNiella / RSP

Refining the Shortest Paths (RSP) of animals tracked with acoustic transmitters in estuarine regions
GNU General Public License v3.0
14 stars 4 forks source link

Issues with runRSP() #29

Closed Jet2191 closed 2 months ago

Jet2191 commented 2 months ago

Hi, I'm really struggling with getting runRSP() and therefore plotTracks() to work. If I run:

water <- actel::shapeToRaster(shape = 'nederland_zuid_holland2.shp', size = 0.0001, buffer = 0.05) tl <- actel::transitionLayer(x = water, directions = 4) rsp.data3 <- runRSP(input = results, t.layer = tl, coord.x = "X_WGS84", coord.y = "Y_WGS84")

I get the error: ' Error in validObject(.Object) : invalid class “SpatialLines” object: bbox should never contain infinite values'. But when I check for infinite values I cannot find them.

If I run:

shapefile <- st_read('nederland_zuid_holland2.shp') r <- raster(extent(shapefile)) res(r) <- 1 crs(r) <- st_crs(shapefile)$proj4string print(extent(r)) print(crs(r)) raster_data <- rasterize(shapefile, r) transition_layer <- transition(raster_data, function(x) 1/mean(x), directions = 8) rsp.data4 <- runRSP(input = test, t.layer = transition_layer, coord.x = "X_WGS84", coord.y = "Y_WGS84")

The runRSP works. But when I plot it: plotTracks(rsp.data4, base.raster = water, type = "both", tag = "A69-9002-7220", track = "Track_1") + addStations(rsp.data) My plot doesn't have the study-area as background. RSP?

I cannot upload my shape files and Rdata here but I can send it to you if needed. Thanks so much in advance!

Jet2191 commented 2 months ago

Never mind, I figured it out. I loaded a shape file of the waters in the area, but it should have been a shape file of the land area.