lssub | R Documentation |
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 |
Filename (and path) to a geotiff image. |
outname |
Filename (and path) for subset image. |
centerx |
x coordinate of new center point. |
centery |
y coordinate of new center point. |
centerepsg |
Projection of the center point coordinates as 5-digit EPSG code. If missing, assume that point and geotiff have the same projection. |
widthx |
Desired width of subset image. |
widthy |
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.
Sarah Goslee
## Not run: lssub("/data/gis/testimage.tif", "/data/gis/subimage.tif", centerx = 260485,
centery = 4527220, centerepsg = 26918, widthx = 50, widthy = 50)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.