POST
|
Thanks, I had seen that. I was after a more detailed description.
... View more
09-25-2012
11:48 PM
|
0
|
0
|
342
|
POST
|
Hi All, I'm trying to find a tutorial on using the Geometry and Cursors but I can't find anything. Can anybody point me in the direction of one? All I've been able to find are the ESRI presentations saying it's possible. I'm trying to do something like the below code extract: for row in arcpy.da.SearchCursor(poly, ("OBJECTID", "SHAPE@")):
if row[0] == 82:
geom = row[1]
for point in arcpy.da.SearchCursor(point, ("SHAPE@")):
pgeom = point[0]
pgeom.intersect(geom,1)
**DO SOMETHING BASED ON THE INTERACTION OF THE POINT/POLY** Thanks
... View more
09-24-2012
05:17 AM
|
0
|
4
|
873
|
POST
|
Hi there, I thought I would reply to this thread as I came across it when searching on a problem resolution. As mentioned before there are conflicts between pyodbc and the 9.3 python geoprocessor. The problem I encounter was when I added fields using pyodbc there were not recognised by the setvalue function in the geoprocessor. I was adding the fields using pyodbc as the AddField command was causing Pythoin to crash. As a test of this I used the below code with a field added using the pyodbc module and one added using the gp function: Field = "x"+str(Con) conn = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb)};DBQ='+Database, autocommit="True") cursor = conn.cursor() AddField = "ALTER TABLE " + os.path.basename(Results) + " ADD COLUMN " + Field +" NUMBER;" cursor.execute(AddField) conn.commit() conn.close() del conn Field = "xx"+str(Con) gp.AddField_management(Results, Field, "Double", "4","", "", "", "", "", "") sFields = gp.ListFields(Results) for field in sFields: print field.Name, field.Type The only fields listed by the list fields function were those from the second adding of the fields (the geoprocessor command), the ones beginning "xx". I hope this is useful for any one who has similar problems and if any solutions exist I would love to hear about them.
... View more
09-17-2010
04:58 AM
|
0
|
0
|
1985
|
POST
|
Thanks for the reply. The line mentioned outputs the cordinates of the to nodes, as per the input file. However no line is created. The only line created is for the first line of the input file. Any ideas
... View more
04-19-2010
11:36 PM
|
0
|
0
|
250
|
POST
|
Hi All, I have a dbf file with from and to points. I'm trying to use the python examples to generate a polyline but it is defeating me! The script I have been using is below. Whenever it is run it generates one visible line and creates attribute table entries for the other rows in the input table. Can anybody suggest what is going wrong? Cheers, Neil. Code (the indentation might not be correct on the posting): import sys, string, os, arcgisscripting gp = arcgisscripting.create(9.3) gp.OverWriteOutput = True Out = r"C:\Test_Out.shp" In = r"C:\In.dbf" gp.workspace = os.path.dirname(Out) gp.CreateFeatureclass(os.path.dirname(Out), os.path.basename(Out), "POLYLINE") cur = gp.InsertCursor (Out) Searchrows = gp.SearchCursor(In) Searchrow = Searchrows.Next() while Searchrow: row = cur.NewRow() LineArray = gp.CreateObject("Array") pnt = gp.CreateObject ("Point") pnt.x = Searchrow.GetValue("From_Lon") pnt.y = Searchrow.GetValue("From_Lat") LineArray.add(pnt) pnt.x = Searchrow.GetValue("To_Lon") pnt.y = Searchrow.GetValue("To_Lat") LineArray.add(pnt) print Searchrow.GetValue("To_Lon"), Searchrow.GetValue("To_Lat") row.shape = LineArray cur.InsertRow(row) Searchrow = Searchrows.Next() del row, cur
... View more
04-19-2010
01:22 AM
|
0
|
4
|
688
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|