|
POST
|
Looking at it again, probably the biggest problem here is that you are deleting your cursor in the middle of your loop. This line should be outside your loop. del techrows
... View more
08-30-2012
12:25 PM
|
0
|
0
|
3060
|
|
POST
|
First off, using nested cursors is generally a bad idea. Extracting the information from your search cursor and storing them in a dictionary to access with your update cursor is the preferred method. That being said, your issue is you define the row object for both cursors as the same variable, causing the code to implode. Also it looks like your indentation may be off.
... View more
08-30-2012
11:57 AM
|
0
|
0
|
3060
|
|
POST
|
Are you doing it directly on the table or through a tableview in python?
... View more
08-30-2012
11:19 AM
|
0
|
0
|
756
|
|
POST
|
All you are doing is taking the last UTM value and projecting that. I'm not really clear on what this code is doing. It will only ever project one file, are you trying to loop through multiple?
... View more
08-29-2012
02:04 PM
|
0
|
0
|
1491
|
|
POST
|
No need to reinvent the wheel. There is the Split Layer By Attributes tool. http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=37AEB018-1422-2418-A036-CA6D9920F808
... View more
08-29-2012
12:53 PM
|
0
|
0
|
1249
|
|
POST
|
\r\n inserts a new line command. var = "OWNER1|OWNER2|MAIL1|MAIL2|CITY_STATE_ZIP5_ZIP4 \r\nDave_Jordan|Page1| | | \r\n|||\r\nBAYVIEW LOAN SERVICING LLC| |895 SW 30 AVE STE 202| |POMPANO BCH FL 33064 0\r\nBUCKSHIN, ROBERT| |4052 FOUNTAIN PALM RD| |COCOA FL 32926 311" elm.text = var
... View more
08-29-2012
12:47 PM
|
0
|
0
|
2127
|
|
POST
|
Can you post the full code you are executing that works in IDLE?
... View more
08-29-2012
08:14 AM
|
0
|
0
|
1491
|
|
POST
|
I had forgot to put in the row object in this line. curs.updateRow(row) That is most likely the issue. Cursors really are the best way to go about searching or updating data on a row by row basis. Passing field objects to the calculate field tool as variables would require you to change them to strings from a list and add the ! to mark them as field variables to the field calculator. You'd have to do something funky like this I think. field_str = "!" + "!, !".join(fieldNameList) + "!"
... View more
08-29-2012
07:54 AM
|
0
|
0
|
2657
|
|
POST
|
What version of ArcGIS are you running? And the problem you are having is the code works in IDLE but not in ArcMap as a tool or through the python window? Also, post your code using [CODE ][ /CODE] tags
... View more
08-29-2012
07:36 AM
|
0
|
0
|
1491
|
|
POST
|
There may be a way to do this is a field calculator, but I would use this method. I think you may also want to modify your SLOSHFIELDS creation since you are extracting the name there and then trying to reference the required parameter and name parameter in your loop. import arcpy
import os
import string
LAYERS = arcpy.GetParameterAsText(0)
SLOSHFIELDS = [f for f in arcpy.ListFields(LAYERS,"","DOUBLE")]
fieldNameList = []
for field in SLOSHFIELDS :
if not field.required:
fieldNameList.append(field.name)
max_field = "MAXSURGE"
curs = arcpy.UpdateCursor(LAYERS)
for row in curs:
max_val = 0
for field in fieldNameList:
val = row.getValue(field)
if val > max_val:
max_val = val
row.setValue(max_field, max_val)
curs.updateRow(row)
... View more
08-29-2012
05:30 AM
|
0
|
0
|
2657
|
|
POST
|
As Chris mentioned earlier, you need to have setValue. rows = arcpy.UpdateCursor("Parcels", "FID = 1")
for row in rows:
row.setValue("GENERATED", "GENERATED")
rows.updateRow(row)
... View more
08-23-2012
12:39 PM
|
0
|
0
|
1782
|
|
POST
|
Thanks for all your response, but can i start an edit session automatically with arcpy script? Thanks No, that would require ArcObjects.
... View more
08-23-2012
11:42 AM
|
0
|
0
|
2563
|
|
POST
|
...three simultaneous answers. that must get some sort of prize. The trifecta crown.
... View more
08-23-2012
08:54 AM
|
0
|
0
|
2563
|
|
POST
|
Try this.
rows = arcpy.UpdateCursor("Parcels", "[OBJECTID] = 1")
for row in rows:
row.setValue("GENERATED", "GENERATED")
rows.updateRow(row) You shouldn't have quotes around your objectid query selection. Also not sure if you have assigned GENERATED as a variable, but if you haven't you will need quotes. Also make sure you are using the right field delimiters for your OBJECTID field.
... View more
08-23-2012
07:48 AM
|
0
|
0
|
2563
|
| 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
|