Basic Question: How to extract a Cell from a raster?

08-30-2014 11:04 AM
New Contributor

hey guys,

hope i´m in the right forum here!

I´m trying to extract a Cell from a raster layer and save it in a new raster layer. For that i wanted to use the "Extract by attributes" tool from the toolbox. The problem is now that this tool needs an attribute table which has to be used to write the sql-expression. But in my case i have a dtm raster that has no attribute table. I want to extract the lowest cell, but the z values are just saved as normal coordinates and not in a table. So my question is: How can i extract cells with a certain height from a dtm, even if the layer has no attribute table? Or is there a way to create a new attribute table for the layer and save the z coordinates with the corresponding cells in it? I´m using ArcGIS 10.1.

What i´m trying to do in general (just if you might have better idea to proceed): I need the lowest cell of the dtm because i want to calculate the distance of each cell of another raster to this cell using the "cost distance" tool, which needs an input cost raster.

Sry for english mistakes and i hope i could well describe my problem!

Tags (1)
0 Kudos
3 Replies
MVP Legendary Contributor

Like GetCellValue in the management toolbox?

>>> help(arcpy.GetCellValue_management)
Help on function GetCellValue in module

GetCellValue(in_raster=None, location_point=None, band_index=None)
    GetCellValue_management(in_raster, location_point, {band_index;band_index...})
       Retrieves the pixel value at a specific x,y coordinate. For multiband raster
       datasets you can specify from which bands to retrieve the cell value. If you do
       not specify any bands, the pixel value for all the bands will be returned for
       the input location.
     in_raster (Mosaic Dataset / Mosaic Layer / Raster Layer):
         The input raster dataset.
     location_point (Point):
         Type the x and y coordinates of the pixel location.
     band_index {Value Table}:
         Define which bands for which you would like to get the pixel value. If you do
         not define any bands, a pixel value for all the bands in the x,y location will
         be returned.


Esri Esteemed Contributor

If you are interested in using some python you could use something like this:

import arcpy

from import *

dem = "C:/examples/data/dem" # reference to your DEM

outname = "C:/examples/data/result" # output raster to be created

dem_ras = arcpy.Raster(dem) # create a raster object

dem_min = dem_ras.minimum # get minimum of dem

outras = Con(dem_ras == dem_min, dem_ras)



New Contributor

Thanks for the Python Code, i will try that out.

0 Kudos