|
POST
|
Looks like missing colon at end of function definition def name (!OWNER1_LAST_NAME!, !OWNER1_FIRST_NAME!): # add this
if len(!OWNER1_FIRST_NAME!)>0 and len(!OWNER1_LAST_NAME!)>0:
return !OWNER1_LAST_NAME! + ', ' + !OWNER1_FIRST_NAME!
else:
return !OWNER1_FIRST_NAME!+!OWNER1_LAST_NAME!
... View more
01-31-2012
12:16 PM
|
0
|
0
|
2937
|
|
POST
|
I would try this mxd.saveACopy(file_name, {version})
... View more
01-31-2012
09:59 AM
|
0
|
0
|
2044
|
|
POST
|
This line may cause issues. PYTHONPATH = "C:\Python26\ArcGIS10.0\lib\ntpath.pyc" Should be as below, if you ave to include it at all. PYTHONPATH = r"C:\Python26\ArcGIS10.0\lib\ntpath.pyc" You can see this link for help and repairing data sources. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s30000004p000000 To format your post correctly, read this. http://forums.arcgis.com/threads/48475-Please-read-How-to-post-Python-code
... View more
01-31-2012
08:27 AM
|
0
|
0
|
2044
|
|
POST
|
I have done something quite similar, though with strings and not int or objectid types, so you may need slightly different formatting based on your needs. For whatever tool you want to plug the where clause in, this should get you started. Should just need some slight modification to accommodate your int type. where = "FIELD in ('" + '\',\''.join(dataList) + "')" Here's a link to a forum thread I think you may be interested in. Correct me if I'm wrong. http://forums.arcgis.com/threads/42445-Python-list-to-where-clause
... View more
01-26-2012
06:59 AM
|
0
|
0
|
1965
|
|
POST
|
If you want ArcGIS specifics then this free course is fairly thorough I hear. I haven't actually gone through all the materials myself, but what I did see seemed like a good base to start with. http://training.esri.com/gateway/index.cfm?fa=catalog.webCourseDetail&courseid=1868
... View more
01-24-2012
05:33 AM
|
0
|
0
|
7131
|
|
POST
|
As far as I know it is a known bug that has yet to be addressed (not sure if it was in 10.0 SP3 though). Here's a previous discussion on it. http://forums.arcgis.com/threads/9507-Update-cursor-on-joined-tables
... View more
01-24-2012
05:23 AM
|
0
|
0
|
934
|
|
POST
|
That error usually comes from running out of memory. You can trying creating table views of sections of your data to go through iteratively. Also make sure you delete your cursor after you are done with it to free the memory it was holding.
... View more
01-24-2012
05:17 AM
|
0
|
0
|
788
|
|
POST
|
No such thing as "import arcpy" is fairly troubling. Try opening IDLE and input help("arcpy"). Should come up with all the information on the module, file location etc. You mentioned previously using 9.3, did you cleanly remove all elements of 9.3 prior to installing 10 on your machine? Python 2.5 as well as Arc 9.3? Could you post the actual error message you are getting?
... View more
01-18-2012
05:27 AM
|
0
|
0
|
416
|
|
POST
|
I think you are just missing some minor things. Take this as an example. rows = arcpy.UpdateCursor(fc) for row in rows: Val = 1 for field in fieldList: CurrVal = row.getValue(field.name) Val = Val * CurrVal # Or whatever you want to do to the values row.NewField = Val rows.updateRow(row)
... View more
01-18-2012
05:18 AM
|
0
|
0
|
869
|
|
POST
|
I think you want to access the arcpy.mapping.Layer(layer).name property. See here http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s300000008000000 Here's a more complete example.
mxd = arcpy.mapping.MapDocument("current")
layers = arcpy.mapping.ListLayers(mxd)
for lyr in layers:
if lyr.name == "something to change":
lyr.name = "changed name"
arcpy.RefreshTOC()
... View more
01-10-2012
05:46 AM
|
1
|
12
|
5587
|
|
POST
|
Most likely, if that field does indeed exist, you are using improper syntax for the field. What is the data type of the feature class you are calculating on? Square brackets are for personal geodatabases. (See http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s500000033000000.htm) Also, double check the field data type to make sure it is numeric. Also, if you are using ArcGIS 10, you should be using arcpy, not the old arcgisscripting. Unless you have it mapped to the new geoprocessor already.
... View more
01-09-2012
12:25 PM
|
0
|
0
|
2512
|
|
POST
|
I usually create a local copy and use arcpy.JoinField_management()
... View more
01-04-2012
07:43 AM
|
0
|
0
|
1355
|
|
POST
|
Try importing less. Something like this should not have a problem as long as the shapefile actually exists in that location and isn't already open by another application.
import arcpy
fc = r"C:\Users\Ben\Documents\ArcGIS\OS OpenData\scotland_and_wales_region_region.shp"
rows = arcpy.SearchCursor(fc)
... View more
01-04-2012
06:19 AM
|
0
|
0
|
822
|
|
POST
|
You say text label, which is not a layout element, it is an element of a feature generally, and not handled by listing layout elements. That you are returning an empty list means something fundamental is going wrong, because even if it can't find your particular text element, any decent layout should have some kind of text elements to find. Open your mxd of interest in ArcGIS, go to the layout view, click insert and click Text. Enter something like "test text". Run the following. mxd = arcpy.mapping.MapDocument("CURRENT")
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
print elm.text
... View more
12-15-2011
12:21 PM
|
0
|
0
|
2242
|
|
POST
|
I just have had a lot of problems using field calculators and models in general. I find straight scripting outside of Arc much more stable.
... View more
12-15-2011
07:23 AM
|
0
|
0
|
1129
|
| 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
|