I have high res raster data covering 2million km sq, with a field where each cell has a value from 0 to 100. I need to create a "mask" using the cells with a value over 12 in that field. I then need to clip vector data to that mask.
I was wondering if there is a good method for selecting cells from rasters and using that selection (with reduced noise and smoothed edges) to clip vector data? I don't have spatial analyst extension. I am using ArcGIS for Desktop 10.1.

  • I've assumed that you are using ArcGIS for Desktop based on your "I don't have spatial analyst extension" and tagged it as such. I think it is helpful on all ArcGIS platform questions to mention the ArcGIS product (and often the version) that you are using.
    – PolyGeo
    Nov 25, 2014 at 7:46

2 Answers 2


You cannot clip a vector file with a raster file. So you need to convert your raster to polygon first. In ArcGIS, you can use "raster to polygon" from the Conversion toolbox (no need for an extension). The problem is that you first need to create the mask, and there is no built in tool in ArcGIS without spatial analyst. So this step has to be done in another software. It is a basic operation, so that you have the choice (GRASS -> r.reclass , gdal_calc -exp A>12, OTB with BandMath application, etc...). If you really want to do it within ArcGIS, you can use arcpy and "RasterToNumPyArray" (also needs numpy), reclass with numpy and go back to raster with "NumPyArrayToRaster".


If you do have ArcGIS and no SA: you might consider converting to points, deleting the values below 12, making the rest of the values a single integer, convert to raster, and then converting to polygon.That polygon would be used in the clips and advanced drawing layer masks, I tested this on an SRTM, and it worked well:

import arcpy
from arcpy import env

Folder = "C:\\Data\\Temp\\STACK"
GDB = "C:\\Data\\Temp\\STACK\\TempGDB.gdb"
env.workspace = GDB
TempP = GDB+"\\TempP"
Poly = GDB+"\\Poly"
InRaster = "C:\\Data\\Temp\\STACK\\Raster"
OutRaster = Folder+"\\OutRaster"
TempPLayer = "TempPLayer"

elevMinResult = arcpy.GetRasterProperties_management(InRaster, "MINIMUM")
elevMaxResult = arcpy.GetRasterProperties_management(InRaster, "MAXIMUM")
CELLSIZEX = arcpy.GetRasterProperties_management(InRaster,"CELLSIZEX")

print "Min: " +str(elevMinResult) +" Max: " + str(elevMaxResult)
print "Cell Size: "+ str(CELLSIZEX)

if arcpy.Exists(TempP):
if arcpy.Exists(OutRaster):
if arcpy.Exists(Poly):

arcpy.RasterToPoint_conversion(InRaster, TempP, "Value")
arcpy.SelectLayerByAttribute_management(TempPLayer, "NEW_SELECTION", " \"grid_code\" < 12 ")
del TempPLayer

arcpy.AddField_management (TempP, "IntValue", "LONG", "", "", "", "IntValue", "NULLABLE")
arcpy.CalculateField_management(TempP, "IntValue","1", "PYTHON")
arcpy.PointToRaster_conversion(TempP, "IntValue", OutRaster, "MAXIMUM", "", CELLSIZEX)
arcpy.RasterToPolygon_conversion(OutRaster, Poly, "NO_SIMPLIFY", "VALUE")

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.