POST
|
Ok, I tried many and many things including your last advice but it still does not work. I don't want to waste your time but could you write the entire code (since it works for you) ?
... View more
01-18-2012
03:04 PM
|
0
|
0
|
571
|
POST
|
Ok thanks for row.mapnumber ! So new try and there is an error on the execution of SelectLayerByAttribute : gp.SelectLayerByAttribute("lyr", "NEW_SELECTION", field + " = " + str(current)) ExecuteError: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute).
... View more
01-18-2012
12:30 PM
|
0
|
0
|
571
|
POST
|
Yeah it's right, I corrected it and it looks good.... ... but another new error message : gp.SelectLayerByAttribute_management("lyr", "NEW_SELECTION", field + " = " + str(row.mapnumber)) RuntimeError: Row: Field mapnumber does not exist What exactly is the row.mapnumber function ? I took a look in both the python docs and the arcgis help but it's not explained..
... View more
01-18-2012
12:00 PM
|
0
|
0
|
571
|
POST
|
Thanks for your reply. I tried your code in my script "test_rte.py" (adapting it by using arcgisscripting instead of acrpy) but I have an error message : File "C:\_basedata_arcgis\test_rte.PY", line 14, in <module> for row in rows: # loop through each feature TypeError: 'geoprocessing cursor object' object is not iterable What could I do to correct this ? Thanks for the help.
... View more
01-18-2012
11:33 AM
|
0
|
0
|
571
|
POST
|
Hello everyone ! I work on ArcGIS 9.3 and I'd want to execute many queries in a row with Python. Actually I have a layer, called "lines" that contains all the bus lines of a city. And my question is : how to save each line in a different layer ? I thought the best thing to do would be : - a query by attributes : field used : "blines". Characterizes the number of the lines (1, 2, 3 and so on) - and then to save each query in a distinct layer A good solution would be a loop in order to make the computation faster but I don't really know how to do. I tried to make that script but I guess I'm very far from the right result :
import sys, string, os, arcgisscripting
gp = arcgisscripting.create(9.3)
gp.AddToolbox("C:/Program Files (x86)/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
# Variables in local
lines_shp = "d:\\Travaux\\NantesMetropole\\lines.shp"
test = ["blines"]
while 1:
for i in test:
try:
gp.Select_analysis(lines_shp, i_shp, i)
print "Query successful"
except:
print "Error"
break
Have you got any ideas ? Thank you ! Julien
... View more
01-18-2012
09:10 AM
|
0
|
12
|
1596
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|