|
POST
|
I "clear" the IDLE screen the same way I used to clear an Xwindow: hold down the enter key until the offending text scrolls off the top. If you do that, IDLE will even skip the >>> prompt on some lines in its haste to respond..... >>> def cls(): print "\n"*30 >>> >>> cls()
... View more
03-27-2013
09:18 AM
|
0
|
0
|
1607
|
|
POST
|
I look as IDLE as the vi of Python IDE's - always there, trustworthy, fast, but not fancy at all. (I'm a big Wing fan myself -- although I don't use 99% of its capabilities, I have found it more than worth the money.)
... View more
03-27-2013
09:06 AM
|
0
|
0
|
1607
|
|
POST
|
I want to to do the following thing: I want to create NoData if the change of the slope angle between cells is >30% But I dont know what I have to do to realize it. Hi Markus, The easiest way to do this (in my opinion) using the Raster Calculator tool: SetNull("slope percent" > 30, "slope percent") The above expression will set all cells of the raster "slope percent" with a value greater than 30 to NoData; the rest of the cells will retain their value. (The input raster is unchanged -- the Raster Calculator tool will save the results to a new raster.) By the way, Fill is used when you are going to computing flow direction. If slope is what you're interested in, you're probably better off using the original, un-filled DEM.
... View more
03-26-2013
07:47 PM
|
0
|
0
|
1775
|
|
POST
|
I, too, have a similar problem as stated in this thread. I tried using the lookup function on my raster Some ideas: - Set the workspace and default workspace to the same location, copy your raster to that same workspace, and try running Lookup again. This is generally best practice when working with raster tools, as the conversion of temporary to permanent rasters only requires a rename, not copying the whole raster. - It's also just generally safer to have the Lookup operate within the same workspace, as there are joins at work. - Make sure your environment (cell size, mask, or extent) aren't interfering with your processing.
... View more
03-26-2013
07:28 PM
|
0
|
0
|
2905
|
|
POST
|
First post! I am new to GIS, so bear with me. I created a flow direction layer, and the layer has more cells than the input surface layer. How can this be? The reason this is a problem for me is that I am using the direction layer to calculate flow accumulation, and I would like to translate this to drainage area. Thanks in advance Before you calculate flow direction make sure that the environment is set up not to resample anything: These should be default or same as your surface raster - outputCoordinateSystem - cellSize Also, it's best practice to set the snapRaster to the surface raster.
... View more
03-26-2013
07:13 PM
|
0
|
0
|
772
|
|
POST
|
#Build the where clause whereClause = "{0} in ('{1}')".format(fieldName, "','".join(values.split(';'))) It's a little trickier than this because the each string value needs to be quoted. #Build the where clause values = values.split(";") # split values into list values = ["'{0}'".format(v) for v in values] # add single quotes whereClause = "{0} IN ({1})".format(fieldName, ",".join(values)) This will generate a string that would work as a SQL expression like: FIELD1 IN ('R12351','R12352') UPDATE: Mathew Coyle's solution also works. I didn't see that he was joining using the string "<single-quote><comma><single-quote>", ie "','". Neat! He's right: Potato, tomato. I just can't resist showing off that most awesome of Python constructs, the "list comprehension", sorry.
... View more
03-26-2013
07:04 PM
|
0
|
0
|
3071
|
|
POST
|
I´m working on a small area shape-fille (Setores Censitários for Brazil). Using ArcMap 9.2. I need to identify which small areas (lines in the dbf) correspond to isolated poligons, i.e., polygons that are islands off the coast. If you did a dissolve with the SINGLE_PART option, the islands would definitely be much smaller than any mainland polygons. To erase them from the dataset, you could select all the small polygons and use the Erase tool to delete them from the original feature class.
... View more
03-26-2013
06:53 PM
|
0
|
0
|
1686
|
|
POST
|
I had the parameters in the wrong order, sorry. The parameters are passed in the order they are listed. Here's my fix: Calculate Value parameters: Expression: RadiusTable(r"%OutputTable%","%RadiusColumns%") Code block:
import os
import arcpy
def RadiusTable(tbl,rc):
arcpy.AddField_management(tbl,"RADIUS","FLOAT")
rc = ";".split(rc)
Rows = arcpy.UpdateCursor(tbl)
k = 0
for Row in Rows:
Row.setValue("RADIUS",rc )
k += 1
del Row, Row
return tbl
Data Type: Table
... View more
03-26-2013
06:46 PM
|
0
|
0
|
7782
|
|
POST
|
Bruce - what is your goal here? Have you looked into the Solar Radiation toolset? Desktop Help 10.1: Understanding solar radiation analysis
... View more
03-25-2013
09:15 PM
|
0
|
0
|
1061
|
|
POST
|
If this is not possible, are there other options that would help me distribute the set of scripts and non-arcpy modules that the user needs to run it? See the python documentation on distutils: Distributing Python Modules
... View more
03-25-2013
03:23 PM
|
0
|
0
|
3334
|
|
POST
|
I get this error when trying to run: ERROR 000539: Error running expression: AddRadiusField(r"Z:\Scratch\1303\130114_temp1.dbf","%RadiusColumns%") <type 'exceptions.NameError'>: name 'AddRadiusField' is not definedFailed to execute (Calculate Value). I'm sorry, I made a mistake in my post - the function names need to match. One more thing, those two inputs should be preconditions to the Calculate Value tool so you are sure they have been calculated before the Calculate Value tool runs. Calculate Value parameters: Expression: RadiusTable(r"%OutputTable%","%RadiusColumns%") Code block:
import os
import arcpy
def RadiusTable(rc,tbl):
arcpy.AddField_management(tbl,"RADIUS","FLOAT")
rc = ";".split(rc)
Rows = arcpy.UpdateCursor(tbl)
k = 0
for Row in Rows:
Row.setValue("RADIUS",rc )
k += 1
del Row, Row
return tbl
Data Type: Table
... View more
03-25-2013
11:50 AM
|
0
|
0
|
7782
|
|
POST
|
After reading up on how inline model variables and iterators work, I am thinking I need to change all the blue ovals ("Seach Radius") to "RadiusColumns" as defined in your expression. But I am unable to duplicate this label since model builder only allows unique names. Also, Following your suggestions would allow me to delete the 'collect values' tool at the top, yes? No, you need to set the Collect Values output (named RadiusColumn) as a precondition to the Calculate Value tool. It is read by Calculate Value as a ";" delimited string, hence the "split" to convert it into a list lf values. The Collect Values is not an iterator, it will just collect those values in one step. The output of the Calculate value is a table, it should be the input for your Export Table To MS Excel tool. The first input should be the table that comes out of your other processing (the one with the automatic name that I suggested renaming). I'm assuming in my calc value code (you should check) that the table rows are coming out in the correct order to match the order of the values in RadiusColumns. Thanks again Curtis, Hope this helps!
... View more
03-25-2013
08:24 AM
|
0
|
0
|
7782
|
|
POST
|
I don't believe the book is available online. You need to buy a paper copy, which includes login info to get supplementary material posted on the web. There is more information about the book at his website: http://jenningsplanet.com I have heard good reviews from Mr. Jennings' students in California!
... View more
03-24-2013
03:36 PM
|
0
|
0
|
786
|
|
POST
|
Chris, I recommend this *free* online course to get you started right: '>Python for Everyone Using ArcGIS 10.1
... View more
03-24-2013
03:29 PM
|
0
|
0
|
1069
|
|
POST
|
Is there any way in Python to export a specific XML element from an SDE feature class, possibly export it into a temporary XML file then update the value of the element in question, then import it back into the SDE feature class? I think the easiest way to do this is 1. Create an empty metadata .xml file ("<metadata></metadata>") 2. Use the Import Metadata tool with the source your feature class and the target your empty file 3. use xmllib to manipulate the XML 4. Use the Import Metadata tool with the source the temp file and the target your feature class You can get fancier using xslt stylesheets and the XML Transformation tool, but, it seems to me the above approach would be easier if you are just adding or updating a single element. [thread]51445[/thread]
... View more
03-24-2013
03:21 PM
|
0
|
0
|
11519
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-11-2021 01:26 PM | |
| 5 | 12-10-2021 04:58 PM | |
| 1 | 02-27-2017 09:30 AM | |
| 2 | 12-04-2023 01:05 PM | |
| 1 | 04-12-2016 10:17 AM |
| Online Status |
Offline
|
| Date Last Visited |
06-19-2024
12:10 AM
|