|
POST
|
mag_subset__2_ != mag_subset___ That's most likely your main problem. Exporting models to python rarely works as intended raw, it gives you a good framework on which to build.
... View more
12-01-2011
09:32 AM
|
0
|
0
|
897
|
|
POST
|
I highly doubt you are getting a 732 error from simply importing arcpy, can you try posting the entire code in code tags?
... View more
12-01-2011
05:12 AM
|
0
|
0
|
897
|
|
POST
|
There is no way to code a pop up window without import a gui module like tkinter. He may be using a simple run with parameters button, which is just an option in most moderately advanced python IDEs, and has nothing to do with your code.
... View more
11-30-2011
01:35 PM
|
0
|
0
|
1911
|
|
POST
|
Doesn't matter, it is a basic tool available in any recent python package. You just use your arcgisscripting instance instead of arcpy. http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=1867&pid=1865&topicname=Make_Feature_Layer_(Data_Management
... View more
11-30-2011
12:25 PM
|
0
|
0
|
1703
|
|
POST
|
Hi Dave, I tested Jake's script and it works fine for me. Are you using proper syntax/indentation? Is there a field called "OBJECTID"? Do you have write access to that directory on Y-drive? Not sure what would be causing this issue. Try something simple like
rows = arcpy.SearchCursor("parcels")
for row in rows:
print row.getValue("OBJECTID")
Then add on line by line until you run into a wall.
... View more
11-30-2011
10:57 AM
|
0
|
0
|
1001
|
|
POST
|
I suspected that might happen, your fc variable is a feature class and has no attribute STFID. It is simply a unicode reference to the feature class in the list. Does each block feature class have a single unique STFID value? You will have to retrieve that value somehow, either assigned manually, read from a field the same way you do with the roads, or some other way. If you don't understand this concept you should try some more simplistic operations to get a grasp of basic arcpy functionality. Esri has some good free online training courses to get you started. Try working through this, it gives a great intro to arcpy and python in general. http://training.esri.com/gateway/index.cfm?fa=catalog.webCourseDetail&courseid=1868
... View more
11-30-2011
09:54 AM
|
0
|
0
|
546
|
|
POST
|
You have to add your script as a script tool if you want any kind of interactivity with user input, outside of command line parameters as you have already seen. If you do not add your script as a script tool, nothing will pop up asking you to choose anything, unless you design your own GUI to do so.
... View more
11-30-2011
04:32 AM
|
0
|
0
|
1911
|
|
POST
|
Should be raw input
outUnsupervised.save(r"e:\Users\profiles\sjmeel77\Desktop\arcgis_jmeel\iso_clustre.pyoutunsup01.tif")
... View more
11-30-2011
04:24 AM
|
0
|
0
|
377
|
|
POST
|
So you mean you want to add a shapefile to your TOC? I think people were confused because opening and adding a shapefile mean two different things to most people. What you want is
arcpy.MakeFeatureLayer_management(yourShapefile, "TOC name")
arcpy.RefreshActiveView()
... View more
11-30-2011
04:15 AM
|
0
|
0
|
1703
|
|
POST
|
This thread will probably help you out, missing path references most likely. http://forums.arcgis.com/threads/23230-quot-ImportError-No-module-named-arcpy-quot-PYTHON
... View more
11-29-2011
01:55 PM
|
0
|
0
|
465
|
|
POST
|
Holding the selection as a variable is unnecessary, Update Cursor will "see" selections and process on those only (when referencing a selectable layer of course). This should work, I am not sure what you are trying to do with the row.STFID = fc.STFID line though. import arcpy
#Set geoprocessing environment
arcpy.env.workspace = r"I:\Dr. Hines\New File Geodatabase.gdb"
arcpy.env.overwriteOutput = True
#Create list of all blocks
fcList = arcpy.ListFeatureClasses("*blk00")
highway = "Analysis Roads"
#Create loop
for fc in fcList:
arcpy.SelectLayerByLocation_management(highway,"HAVE_THEIR_CENTER_IN", fc)
rows = arcpy.UpdateCursor(highway)
for row in rows:
row.STFID = fc.STFID
rows.updateRow(row)
del row
del rows
... View more
11-29-2011
12:30 PM
|
0
|
0
|
1310
|
|
POST
|
I would recommend something as follows. You could use the getValue instead of row references too. Format where statement as needed.
where = "\"Land_Area\" > 0"
rows2 = arcpy.UpdateCursor(parcels, where)
for row2 in rows2:
row.UTC10_Pct = row.UTC10_Ft / row.Land_Area
rows2.updateRow(row2)
... View more
11-23-2011
01:06 PM
|
0
|
0
|
905
|
|
POST
|
As far as I know, the calculate field tool processes on the entire field, not on your current search cursor selection. I could be wrong. Why not use update cursor? Much better than calculate field. And why not use a selection instead of a search cursor?
... View more
11-23-2011
11:39 AM
|
0
|
0
|
905
|
|
POST
|
I think you'd want mxd.save() Instead of mxd.saveACopy()
... View more
11-23-2011
06:05 AM
|
0
|
0
|
2655
|
| 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
|