2

I have a georeferenced raster. Instead of extracting or clipping it by a clip feature or co-ordinate, I need to clip it by row and column number.

i.e. I want BX.tif to be columns 2150:2400 and rows 1250:1650 of B2.tif.

1
  • 3
    Have you considered GDAL_Translate with -srcwin xoff yoff xsize ysize? Supply the origin xoff, yoff in col/row then the xsize cols and ysize rows; note that xoff and yoff are offset from the upper left and the sizes shouldn't be negative. ArcGIS has Clip_management resources.arcgis.com/en/help/main/10.2/index.html#//… but that requires an envelope in georeferenced coordinates. Jun 20, 2017 at 21:09

2 Answers 2

1

Set environment extent and cell size to your raster. Go to python window and type:

>>> arcpy.gp.SingleOutputMapAlgebra_sa("$$ROWMAP + 1")
>>> arcpy.gp.SingleOutputMapAlgebra_sa("$$COLMAP + 1")

rename outputs in table of content and use field calculator:

Con(("COLS" <= 50)  & ("COLS" >= 10) & ("ROWS" <= 50) & ("ROWS" >= 20),1)

Convert output to polygon and set environment extent to it. Use raster calculator to compute extract, e.g. type "DEM"

Credits go to @Luke

1

I addressed this using Michael Miles-Stimson's comment - in gdal

gdal_translate -srcwin 1250 2150 401 251 input.tif output.tif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.