|
POST
|
You need to tell us what the exact error is, it's very important. Copy the entire error message and post it here. Also, please enclose your python code in [noparse] [/noparse] tags to preserve the indentation. This is very important as indentation is is part of the syntax. See this post for further information.
... View more
01-19-2014
10:16 AM
|
0
|
0
|
684
|
|
POST
|
Just to reiterate, pythonw.exe is not the PythonWin executable. That is located at <python install dir>\Lib\site-packages\pythonwin\Pythonwin.exe (i.e. for 10.1 it is C:\Python27\ArcGIS10.1\Lib\site-packages\pythonwin\Pythonwin.exe).
... View more
01-19-2014
10:14 AM
|
0
|
0
|
1726
|
|
POST
|
See the 2nd answer to this question: http://forums.arcgis.com/threads/91591-Con-tool-error-The-truth-value-of-a-raster-is-ambiguous Use | instead of OR
... View more
01-17-2014
07:15 PM
|
0
|
0
|
981
|
|
POST
|
Installing other versions of python is what messed up arcpy. You don't need to install other versions, you can use PyScripter/Pythonwin with whatever version of python is already installed. What version of ArcGIS are you using?
... View more
01-15-2014
02:25 PM
|
0
|
0
|
2907
|
|
POST
|
If your Z units are in metres, then yes - http://resources.arcgis.com/en/help/main/10.1/index.html#//009t00000056000000
... View more
01-09-2014
06:55 PM
|
0
|
0
|
1174
|
|
POST
|
I'm still not sure what you are trying to do? In your example of a buffer crossing 2 cells with values of 25 and 75, the focal stats method I describe would give you the value 50 that you expect. If you actually buffer the points and create a vector polygon, then use the zonal statistics as table tool to extract the average, you will get exactly the same answer, but you have the overhead of creating the buffer which ArcGIS will then convert back to a raster behind the scenes before extracting the mean value. Another drawback to this method is that buffers that overlap can't be processed.
... View more
01-07-2014
12:50 PM
|
0
|
0
|
1268
|
|
POST
|
In the raster calculator you could use the Aggregate and Con functions: Aggregate(Con("landuse_raster" == somenumber, 1, 0), 30, "SUM") / 900.0 Note replace "somenumber" with the relevant land use code each time you run the calculation.
... View more
12-28-2013
11:46 PM
|
0
|
0
|
1546
|
|
POST
|
You can download 90m resolution SRTM Digital Elevation Model data (in 1x1 or 5x5 degree tiles) over Turkey from http://srtm.csi.cgiar.org
... View more
12-18-2013
07:13 PM
|
0
|
0
|
714
|
|
POST
|
Use the Focal Statistics tool, set statistic to "Mean" and neighbourhood to NbrCircle(radius, "MAP"). If your map units units are metres and you want a 1 nautical mile "buffer" use a radius of 1852. This will output a new raster where each cell is assigned the average of all cells from the original raster that are within a 1nmi radius. Then use the Extract Values To Points tool to get the values for your point features.
... View more
11-29-2013
12:19 AM
|
0
|
0
|
1268
|
|
POST
|
Create a function in the pre-logic script code block e.g.: def trim(fieldvalue):
fieldvalue=' '.join(fieldvalue.strip().split())
# in case fieldvalue=='', change empty string to space
# to avoid "Field is not Nullable" error
if not fieldvalue: fieldvalue=' '
return fieldvalue [ATTACH=CONFIG]29091[/ATTACH]
... View more
11-13-2013
12:47 PM
|
1
|
0
|
1084
|
|
POST
|
General python: http://www.diveintopython.net http://learnpythonthehardway.org http://pymotw.com/2/ And of course google.com : ) ArcPy specific http://resources.arcgis.com/en/help/main/10.2/index.html#/What_is_ArcPy/000v000000v7000000/ And of course google.com : ) I'm not being a smart@ss with the google comments... Once you're familiar with basic python syntax, I find it's muuuch easier to search for something than try and find what I'm looking for in the help/other doco.
... View more
11-07-2013
02:36 PM
|
0
|
0
|
1202
|
|
POST
|
You can't pass a raster to the math.erf function. You'll get a "TypeError: a float is required" exception. Here's some python code to run your expression: Note - I take no responsibility for the correctness of the ERF implementation! I just copied it off teh interwebz and modified it to work with raster objects... import arcview,arcpy,math
from arcpy.sa import *
def erf(x):
''' Error function modified for rasters from the pure python implementation
posted on StackExchange [1] of the algorithm from the
Handbook of Mathematical Functions [2]
[1] http://stackoverflow.com/a/457805/737471
[2] http://people.math.sfu.ca/~cbm/aands/frameindex.htm
'''
# save the sign of x
#sign = 1 if x >= 0 else -1 # This doesn't work with a Raster object
# ValueError: The truth value of a raster is ambiguous.
# Invalid use of raster with Boolean operator or function.
sign = (x>=0) + ((x<0)*-1)
x = Abs(x)
# constants
a1 = 0.254829592
a2 = -0.284496736
a3 = 1.421413741
a4 = -1.453152027
a5 = 1.061405429
p = 0.3275911
# A&S formula 7.1.26
t = 1.0/(1.0 + p*x)
y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*Exp(-x*x)
return sign*y
if __name__=='__main__':
input_raster='path/to/input/raster'
output_raster='path/to/output/raster'
arcpy.CheckOutExtension('spatial')
inras=Raster(input_raster)
outras = 0.5*(1+erf((inras)/math.sqrt(2*2*2)))
outras.save(output_raster)
... View more
10-27-2013
09:26 PM
|
0
|
0
|
503
|
|
POST
|
You can use the Sample tool to output z,x,y values to a DBF table, then convert that to a text file. Note: The answer that "nidhinkn" posted (Raster to ASCII) will _not_ work as it does not output X & Y values.
... View more
10-23-2013
08:07 PM
|
0
|
0
|
761
|
|
POST
|
The image software ENVI is one good tool to do it through creating training area and reclassify whole raster image. The ArcGIS is not a good tool to do it. How does a supervised classification in ENVI help answer the OP's question? (which is a very simple operation in ArcGIS Spatial Analyst).
... View more
10-03-2013
09:02 PM
|
0
|
0
|
970
|
|
POST
|
Have a read of the Raster dataset zones and regions help topic. Then check out the Zonal Statistics tool which I used to do this: [ATTACH=CONFIG]28034[/ATTACH]
... View more
10-03-2013
08:00 PM
|
0
|
0
|
970
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-24-2022 03:08 PM | |
| 1 | 07-30-2025 03:00 PM | |
| 1 | 06-10-2025 08:06 PM | |
| 5 | 05-20-2025 07:56 PM | |
| 1 | 05-04-2025 10:34 PM |