sinkovit / Spatial-ecology

Space use software deployed in the Spatial Ecology Gateway
MIT License
2 stars 0 forks source link

Save rasters to a file #29

Closed monaw closed 1 year ago

monaw commented 1 year ago

filename should be .

monaw commented 1 year ago

use writeRaster function

monaw commented 1 year ago

geotiff, ascii format? Bob will work on writing the raster files & shape files (5-6 files, .dbx, .shape) shape file based on Jesse's code (sp is being replaced)

monaw commented 1 year ago

From Bob on Slack:

After doing some exploring, I discovered that the code you need to write the rasters and shape files already exists (commented out) in the file compute.R, function createContour(). You'll just need to connect to buttons so that the files are written out. The following block writes out the raster file

# # Create raster of contours
 # raster.contour <- rasterToContour(rst.mkde, levels = cont$threshold)
 # proj4string(raster.contour) = CRS(crsstr)
 # writeRaster(rst.cont, filename, format = "ascii", overwrite = T)

And this block writes the shape files.

# # Create shapefiles of contours
 # raster.contour = spChFIDs(raster.contour, paste(contour_probs, "% Contour Line", sep=""))
 # proj4string(raster.contour) = CRS(crsstr)
 # shapefile(x = raster.contour, file = filename, overwrite = T)

Note that writing the raster creates a single file (e.g., condor.asc) while the shape files creates a set of five files (e.g., condor_[allcountour|outercontour].[cpg, dbf, prj, shp, shx). I committed one minor change to the dev branch so that we use just the basename, without [_allcountour|outercontour], which only makes sense for shape files. (edited)

monaw commented 1 year ago

@sinkovit, so both raster and shape files are output of MKDE plotting only, not the MCP plot right?

sinkovit commented 1 year ago

Yes, they are both output from MKDE. We don’t have any output for the MCP and it’s currently being used only for getting an overview of the data.

From: MonaW @.> Date: Friday, June 23, 2023 at 6:40 PM To: sinkovit/Spatial-ecology @.> Cc: Sinkovits, Robert @.>, Mention @.> Subject: Re: [sinkovit/Spatial-ecology] Save rasters to a file (Issue #29)

@sinkovithttps://urldefense.com/v3/__https:/github.com/sinkovit__;!!Mih3wA!DP44e0ScyscUX88ItebPZomIlc1LBY8Y0BpdND8fTB7C5gkX4RA2nl6K45kQy4U0VIGzZy9L5AXLAIfXgGagywlx$, so both raster and shape files are output of MKDE plotting only, not the MCP plot right?

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/sinkovit/Spatial-ecology/issues/29*issuecomment-1605227694__;Iw!!Mih3wA!DP44e0ScyscUX88ItebPZomIlc1LBY8Y0BpdND8fTB7C5gkX4RA2nl6K45kQy4U0VIGzZy9L5AXLAIfXgEghoakY$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ABH5QMCWGX4YEHVIHE2XUDTXMZAPFANCNFSM6AAAAAAQ76WFRQ__;!!Mih3wA!DP44e0ScyscUX88ItebPZomIlc1LBY8Y0BpdND8fTB7C5gkX4RA2nl6K45kQy4U0VIGzZy9L5AXLAIfXgALr7mSp$. You are receiving this because you were mentioned.Message ID: @.***>

sinkovit commented 1 year ago

That is correct. They are both output from MKDE. We don’t have any output for the MCP and it’s currently being used only for getting an overview of the data.