Skip to main content
added 235 characters in body
Source Link
Robert Hijmans
  • 11.1k
  • 27
  • 37

You can do the following:

library(terra)
e <- ext( c(4304916, 4305325, 365216, 365439) )
p <- as.polygons(e)
crs(p) <- "+proj=utm +zone=18 +ellps=GRS80 +datum=NAD83 +units=m"
writeVector(p, 'file.shp')

Or with the raster package

library(raster)
e <- extent( c(4304916, 4305325, 365216, 365439) )
p <- as(e, 'SpatialPolygons')
crs(p) <- "+proj=utm +zone=18 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
shapefile(p, 'file.shp')

You can do the following:

library(raster)
e <- extent( c(4304916, 4305325, 365216, 365439) )
p <- as(e, 'SpatialPolygons')
crs(p) <- "+proj=utm +zone=18 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
shapefile(p, 'file.shp')

You can do the following:

library(terra)
e <- ext( c(4304916, 4305325, 365216, 365439) )
p <- as.polygons(e)
crs(p) <- "+proj=utm +zone=18 +ellps=GRS80 +datum=NAD83 +units=m"
writeVector(p, 'file.shp')

Or with the raster package

library(raster)
e <- extent( c(4304916, 4305325, 365216, 365439) )
p <- as(e, 'SpatialPolygons')
crs(p) <- "+proj=utm +zone=18 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
shapefile(p, 'file.shp')
Source Link
Robert Hijmans
  • 11.1k
  • 27
  • 37

You can do the following:

library(raster)
e <- extent( c(4304916, 4305325, 365216, 365439) )
p <- as(e, 'SpatialPolygons')
crs(p) <- "+proj=utm +zone=18 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
shapefile(p, 'file.shp')