|
POST
|
First off cursors can be created with a query so selecting by attributes to run a cursor on the selection is 100% redundant. How big are your singleList and dupList variables? Those seem like where the biggest bottleneck using your code would be.
... View more
04-30-2013
05:26 AM
|
0
|
0
|
1553
|
|
POST
|
You probably have a null value in your row. This should get you around that.
if row[0]:
row[2] = row[0] * (32.82010551 * 32.82010551) * (0.000000092903)
if row[1]:
row[3] = (row[1] *(32.82010551 * 32.82010551) * 25)/(row[0] * (32.82010551 * 32.82010551))
... View more
04-25-2013
02:50 PM
|
0
|
0
|
1073
|
|
POST
|
Pretty close, you just need one row reference though for your range. One other thing, you don't need to update your row after each if statement, you can just do it once at the end to save some lines. You also had an "O" in your first if statement instead of a zero. Try this. rows = arcpy.UpdateCursor(STHDLINES) for row in rows: if row.Bkf_W <= 0: row.Width_Cat = 0 elif 0 < Bkf_W <= 3: row.Width_Cat = 1 elif 3 < Bkf_W <= 50: row.Width_Cat = 2 elif row.Bkf_W > 50: row.Width_Cat = 3 rows.updateRow(row) You are most likely having issues with Notepad++ because it doesn't discriminate between tabs and spaces as well as other IDEs do.
... View more
04-25-2013
08:45 AM
|
0
|
0
|
1691
|
|
POST
|
Not sure what you are asking. Do you just need to figure out python syntax? 0 < Bkf_W <= 3 is perfectly valid, though your indentation is off in the code you posted.
... View more
04-25-2013
07:24 AM
|
0
|
0
|
1691
|
|
POST
|
Not currently, the da cursors do not return row objects in the same manner the regular cursors do, merely a list/tuple with values.
... View more
04-24-2013
11:32 AM
|
0
|
0
|
542
|
|
POST
|
Yes you can do that. You would just need to reference the layer names as layer objects in the mxd. eg flayer = arcpy.mapping.ListLayers(mxd, "AADT")[0]
alayer = arcpy.mapping.ListLayers(mxd, "AADTAnnoLabel")[0]
... View more
04-24-2013
10:42 AM
|
0
|
0
|
1551
|
|
POST
|
OK, when I change my code to work for the traditional cursors I get the lovely Error: 999999: Error executing function. Which from what i get from other threads in the forum, this is not good. Iam running it in the python window inside the mxd could that be the problem?
import arcpy
flayer = "AADT"
alayer = "AADTAnnoLabel"
FRows = arcpy.SearchCursor(flayer,"","","","FLAG")
ARows = arcpy.SearchCursor(alayer,"","","","TFLAG")
FList = []
AList = []
for row in FRows:
Fvalue = row.getValue("FLAG")
FList.append(str(Fvalue))
for rows in ARows:
Avalue = row.getValue("TFLAG")
AList.append(str(Avalue))
matched = set(FList) & set(AList)
for x in matched:
exp = "ID = " + x
arcpy.SelectLayerByAttribute_management(flayer, "ADD_TO_SELECTION", exp)
arcpy.SelectLayerByAttribute_management(flayer, "SWTCH_SELECTION")
Runtime error <type 'exceptions.RuntimeError'>: ERROR 999999: Error executing function.
Is the error coming from your search cursor line? If so the most likely cause of a 999999 error is that the fields you are trying to sort by do not exist in that table.
... View more
04-23-2013
01:41 PM
|
0
|
0
|
1551
|
|
POST
|
As of 10.1 all arcpy tools should support kwargs for parameters. 10.0 they did not.
... View more
04-22-2013
11:34 AM
|
0
|
0
|
2168
|
|
POST
|
That all seems fine, what is the error message you get?
... View more
04-18-2013
08:25 AM
|
0
|
0
|
2491
|
|
POST
|
You can upgrade ArcGIS for Desktop to use 64-bit geoprocessing as well.
... View more
04-18-2013
08:22 AM
|
0
|
0
|
2496
|
|
POST
|
Is there a specific reason you are mixing 32-bit and 64-bit geoprocessing environments?
... View more
04-18-2013
07:23 AM
|
0
|
0
|
2496
|
|
POST
|
I'm not sure why you would have an issue with using the qualified name. I don't get any error when using the same layer name as the feature class name. How are you creating your mxd and df objects?
... View more
04-18-2013
07:14 AM
|
0
|
0
|
2491
|
|
POST
|
I think you want to use MakeFeatureLayer and add that as a layer object to your map. http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000006p000000
... View more
04-17-2013
02:05 PM
|
0
|
0
|
2491
|
|
POST
|
I am pretty sure in 10.1 you can create a python add-in that can accept x,y mouse clicks as an input. You should be able to reference the highlighted row of a table to get the values and insert those attributes into a point feature class along with the x,y input from the mouse. How to specifically go about doing this I'm not sure, I haven't made any tools with that kind of functionality.
... View more
04-17-2013
10:40 AM
|
0
|
0
|
998
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-17-2011 10:36 AM | |
| 1 | 08-16-2012 10:48 AM | |
| 1 | 10-31-2012 08:39 AM | |
| 1 | 07-16-2012 01:52 PM | |
| 1 | 03-15-2012 10:57 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-22-2024
11:12 PM
|