Uses GDAL tools to reproject (optional) and subset a geotiff given the center point and the desired size.
lssub(filename, outname, centerx, centery, centerepsg, widthx, widthy)
- Filename (and path) to a geotiff image.
- Filename (and path) for subset image.
- x coordinate of new center point.
- y coordinate of new center point.
- Projection of the center point coordinates as 5-digit EPSG code. If missing, assume that point and geotiff have the same projection.
- Desired width of subset image.
- Desired height of subset image.
The new image will be a subset of size (widthx, widthy) with center point (centerx, centery), with the same pixel size. If the center point coordinates are in a different projection than the original image, they will be reprojected.
The new image is exported as a geotiff. Nothing is returned within R.
Requires gdalinfo and gdaltransform to be available to the operating system. Only known to work on linux. This function was written to speed processing of multiple files for a specific project, and may be dropped in future releases of the landsat package. On my computer, lssub() is over an order of magnitude faster than reading the image into R, subsetting it, and writing out the result.
## Not run:lssub("/data/gis/testimage.tif", "/data/gis/subimage.tif", centerx = 260485, centery = 4527220, centerepsg = 26918, widthx = 50, widthy = 50)## End(Not run)
Documentation reproduced from package landsat, version 1.0.8. License: GPL (>= 2)