Erase a polygon from a raster

3645
7
10-16-2010 07:55 AM
MarcusGriswold
New Contributor
Hi

I am attempting to erase a series of polygons from a raster set.  I have ArcView w/Spatial Analyst version 10.0. 

I have converted the polygon to a raster and tried to subtract the two and have tried this code to no avail.
SetNull( Not IsNull( [PolyRaster] ), [MyRaster] )

Any help would be appreciated.

Thanks

Marcus
0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus
request that you General post be moved here...do not duplicate post, it isn't good for seaches
0 Kudos
MarcusGriswold
New Contributor
Dan,

I am using ArcMap 10.  The error I received was a parsing syntax error. Maybe we can start with square one if you have time.  I have a raster and I want to erase the area of all polygons in a single shapefile from it.
0 Kudos
MarcusGriswold
New Contributor
This is the error I received from that code:


Messages
Executing: RasterCalculator SetNull( Not(IsNull( "protect" )), "nlcdforse" ) C:\temp\privfor
Start Time: Thu Oct 21 15:08:06 2010
SetNull( Not(IsNull( Raster(r"protect") )), Raster(r"nlcdforse") )
ERROR 000539: Error running expression: rcexec() <type 'exceptions.NameError'>: name 'Not' is not defined
Failed to execute (RasterCalculator).
Failed at Thu Oct 21 15:08:06 2010 (Elapsed Time: 0.00 seconds)


Any thoughts?

Thanks

Marcus
0 Kudos
DanPatterson_Retired
MVP Emeritus
I can confirm that Not =! ~  the latter is used by 10 and note that there is no pop-up help or tool-tips to indicate so, so use ~ in place of Not and bookmark the page Bill referenced
0 Kudos
MarcusGriswold
New Contributor
Great - Thanks! It would be great if there were a better error associated with it.
0 Kudos
toddsams
New Contributor III
Can this be done in SOMA tool? I tried and it gave a message that "Not" is not a valid operator (also tried ~). I am using 9.3.1
0 Kudos
RafaelFernandes2
New Contributor
So I needed to do something like that, in 10. But in the result I get a raster without the erased parts, witch is good, but it also cuts other parts in my case, it cuts the top in a straight horizontal line, and the right side also in a vertical straight line.

Any suggestions?
0 Kudos