## Example using shapefile "possumarea.shp" in
## "extdata" folder. As 'cluster' is not specified,
## the grid comprises single multi-catch detectors.
if (FALSE) {
## test for availability of GPSBabel
if (nzchar(Sys.which("gpsbabel"))) {
library(sf)
shpfilename <- system.file("extdata/possumarea.shp", package = "secr")
possumarea <- st_read(shpfilename)
possumgrid <- make.systematic(spacing = 100, region = possumarea,
plt = TRUE)
## May upload directly to GPS...
# writeGPS(possumgrid, proj = "+proj=nzmg")
## ...or save as Mapsource file
writeGPS(possumgrid, o = "gdb", F = "tempgrid.gdb",
proj = "+proj=nzmg")
## If `region' had been specified in another projection we
## would need to specify this as in Proj.4. Here is a
## hypothetical example for New Zealand Transverse Mercator
## with datum NZGD2000 (EPSG:2193)
NZTM <- paste("+proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996",
"+x_0=1600000 +y_0=10000000 +ellps=GRS80",
" +towgs84=0,0,0,0,0,0,0 +units=m +no_defs")
# writeGPS(possumgridNZTM, o = "gdb", F = "tempNZTM.txt",
# proj = NZTM)
## Or to upload coordinates from UTM Zone 18 in eastern
## Maryland, USA...
# writeGPS(MarylandUTMgrid, proj =
# "+proj=utm +zone=18 +ellps=WGS84")
}
}
Run the code above in your browser using DataLab