|
POST
|
Use a GUI toolkit to create a popup input dialog. Tkinter ships with Python, there are also others, wxPython and pyQT for example. Here is some code to generate an input dialog with Tkinter: http://effbot.org/tkinterbook/tkinter-dialog-windows.htm
... View more
10-30-2011
08:04 PM
|
0
|
0
|
548
|
|
POST
|
Dan, what version of ArcGIS are you using? If <=9.3.1 you can simply use the grid variable $$YMAP in any Map Alegbra expression (ArcToolbox or Raster Calculator) - assuming you are working in a geographic coordinate system and you have set your analysis environment up (cell size, extent, etc). In 10.0 this has been removed (or hidden). You can still use it with a little bit of python scripting, see http://forums.arcgis.com/threads/18608-internal-grids-rowmap-colmap-xmap-ymap#post106446
... View more
10-20-2011
06:26 PM
|
0
|
0
|
624
|
|
POST
|
Convert input or highest raster to floating point before dividing. (Input Raster/float(Highest) # in Input Raster)* 5 If you want the output to be integer int((Input Raster/float(Highest) # in Input Raster)* 5)
... View more
10-18-2011
05:54 PM
|
0
|
0
|
493
|
|
POST
|
Eric, if you add 0.5 before truncating with INT, you will get values rounded to the nearest whole integer (ignoring any binary floating point issues and which way to round negative ties). Using your example (4.2 and 4.9)... as 4.7+0.5 = 4.7 and 4.9 + 0.5 = 5.4, int(4.2 + 0.5) == 4 and int(4.9 + 0.5) == 5
... View more
10-10-2011
07:32 PM
|
0
|
0
|
1220
|
|
POST
|
The curly braces indicate optional parameters and are not part of the syntax, this is documented in the help - http://help.arcgis.com/en/arcgisdesktop/10.0/help/002t/002t00000011000000.htm The correct syntax would be something like: Con ( "Cost1" < "Cost2", "1", "2")
... View more
10-10-2011
07:24 PM
|
0
|
0
|
463
|
|
POST
|
Please wrap your script in code tags so the indentation is preserved. Especially when your problem IS with indentation... I had a look at the page source. You don't have an indented block after the except clause:
... View more
09-23-2011
06:46 AM
|
0
|
0
|
680
|
|
POST
|
Have a read of the floating point tutorial. It's for python, but don't worry about that, it's one of the best explanations of the floating point representation issue I've come across. Basically, don't worry about exact values, what you're getting is as close as can be represented with as base 2 (binary) fractions. If you really must have control over this, keep your data as integer (multiply by 10^n where n is the number of decimal places you wish to keep).
... View more
09-20-2011
05:38 PM
|
0
|
0
|
505
|
|
POST
|
I'm sure Mr Huber will have a better answer, but my first thought would be indicator kriging: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00310000004n000000.htm
... View more
09-20-2011
04:53 PM
|
0
|
0
|
461
|
|
POST
|
Floating point grids can not have VATs. Make sure your output is an integer grid and use the "build raster attribute table" or "BuildVAT" tool. If you need floating point values, multiply by 10^n (where n is the number of decimal places you wish to retain) before truncating/rounding to an integer raster.
... View more
09-20-2011
04:44 PM
|
0
|
0
|
437
|
|
POST
|
arcpy methods are CaSe SensiTive at ArcGIS 10. Use "Describe" instead of "describe". The following works for me on our SDE server: arcpy.env = SDEConnection
desc = arcpy.Describe(SDEConnection)
domains = desc.Domains
for domain in domains:
print domain
... View more
09-20-2011
04:25 PM
|
0
|
0
|
2140
|
|
POST
|
There's a few issues: 1. You assign the mean & st_dev variables to a raster instead of assigning to the output of the GetRasterProperties tool. 2. The GetRasterProperties tool returns a "Result" object which has a GetOutput method that you need to use to access the mean/std values. 3. Your calculation has a few errors - no terminating quote, the text doesn't match any of the variables you set previously, and the "rastercalc" raster has no operator linking it to the rest of the expression. The following code works, but you'll need to check the actual expression as I stuck a "+" operator in front of the "rastercalc" raster so the expression would actually run, substitute it with whatever operator you require. #...
# Process: Get Raster Properties
Mean = float(arcpy.GetRasterProperties_management(Input_raster, "MEAN").getOutput(0))
# Process: Get Raster Properties (2)
St_Dev = float(arcpy.GetRasterProperties_management(Input_raster, "STD").getOutput(0))
# Process: Raster Calculator
calc='("%s" - %s) / %s + "%s"'%(Input_raster,Mean,St_Dev,rastercalc)
result=arcpy.gp.RasterCalculator_sa(calc)
print result.GetMessages()
print result.GetOutput(0)
... View more
09-20-2011
03:59 PM
|
0
|
0
|
530
|
|
POST
|
You could use a recursive 'glob':
class rglob:
'''A recursive/regex enhanced glob
adapted from os-path-walk-example-3.py - http://effbot.org/librarybook/os-path.htm
'''
def __init__(self, directory, pattern="*", regex=False, regex_flags=0, recurse=True):
''' @type directory: C{str}
@param directory: Path to search
@type pattern: C{type}
@param pattern: Regular expression/wildcard pattern to match files against
@type regex: C{boolean}
@param regex: Use regular expression matching (if False, use fnmatch)
See U{http://docs.python.org/library/re.html}
@type regex_flags: C{int}
@param regex_flags: Flags to pass to the regular expression compiler.
See U{http://docs.python.org/library/re.html}
@type recurse: C{boolean}
@param recurse: Recurse into the directory?
'''
self.stack = [directory]
self.pattern = pattern
self.regex = regex
self.recurse = recurse
self.regex_flags = regex_flags
self.files = []
self.index = 0
def __getitem__(self, index):
import os
while 1:
try:
file = self.files[self.index]
self.index = self.index + 1
except IndexError:
# pop next directory from stack
self.directory = self.stack.pop()
try:
self.files = os.listdir(self.directory)
print self.files
self.index = 0
except:pass
else:
# got a filename
fullname = os.path.join(self.directory, file)
if os.path.isdir(fullname) and not os.path.islink(fullname) and self.recurse:
self.stack.append(fullname)
if self.regex:
import re
if re.search(self.pattern,file,self.regex_flags):
return fullname
else:
import fnmatch
if fnmatch.fnmatch(file, self.pattern):
return fullname
import shutil
search_dir=r'C:\Project'
out_dir=r'C:\Workspace'
for jpg in rglob(search_dir,'*.jpg'):
print 'Copying: ' + jpg
shutil.copy(jpg,out_dir)
... View more
09-15-2011
08:21 PM
|
0
|
0
|
1356
|
|
POST
|
Get cell size directly from the raster band: for row in csvReader:
desc = arcpy.Describe(row[1]+"/Band_1")
cellSizeVal = desc.meanCellWidth
arcpy.env.cellSize = cellSizeVal
... View more
08-26-2011
03:06 PM
|
0
|
0
|
639
|
|
POST
|
No, not a bug. From the NumPy documentation: Data in new ndarrays is in the row-major (C) order .
... View more
08-02-2011
05:20 PM
|
0
|
0
|
512
|
|
POST
|
It sounds like you are expecting a multi-value parameter (e.g. '123;234;345'). In this case you can use list comprehensions, the map() function or a loop: #List comprehension:
Pop_options = [int(p) for p in Pop_option.split(";")]
#Map function
Pop_options = map(int, Pop_option.split(';'))
#Loop
Pop_options=[]
for p in Pop_option.split(';'):
Pop_options.append(int(p))
... View more
07-31-2011
06:13 PM
|
0
|
0
|
1265
|
| Title | Kudos | Posted |
|---|---|---|
| 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 | |
| 5 | 04-22-2025 09:04 PM |