|
POST
|
@ fabl and mdenil, thanks for your response... I want to use the code you suggested to create a list of geoprocessing operations on each of the rows in a feature. I would start with the first row and generate a final pdf output, then move to the next row till the searchcursor is through with all the rows; im thinking along the line of the code you suggested but im not sure if it would take each of the rows one at a time, below is an example of what i want fc = "Parcels"
field = "Plot_No"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
feat = row.getValue(shapefieldname) # this gives you the geometry
val = row.getValue(field)
outFC = str(val) + "_Buffer" + ".shp" # there should be no Null-values in "Plot_No", the values have to be unique
arcpy.Buffer_analysis(feat , outFC, "15 meters", "FULL", "ROUND", "NONE")
dfAsFeature = arcpy.Polygon(arcpy.Array([df.extent.lowerLeft, df.extent.lowerRight, df.extent.upperRight, df.extent.upperLeft]),df.spatialReference)
arcpy.Clip_analysis(lyr,dfAsFeature,outFC)
arcpy.mapping.ExportToPDF(mxd,r"C:\KWARA_STATE\\" + outName + "\\" + outName1 + "\\" + "TDP_For_" + outName2)
fc = "Parcels"
field = "Plot_No"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
feat = row.getValue(shapefieldname) # this gives you the geometry
val = row.getValue(field)
outFC = str(val) + "_Buffer" + ".shp" # there should be no Null-values in "Plot_No", the values have to be unique
arcpy.Buffer_analysis(feat , outFC, "15 meters", "FULL", "ROUND", "NONE")
dfAsFeature = arcpy.Polygon(arcpy.Array([df.extent.lowerLeft, df.extent.lowerRight, df.extent.upperRight, df.extent.upperLeft]),df.spatialReference)
arcpy.Clip_analysis(lyr,dfAsFeature,outFC)
arcpy.mapping.ExportToPDF(mxd,r"C:\KWARA_STATE\\" + outName + "\\" + outName1 + "\\" + "TDP_For_" + outName2)
Im not particularly sure if i have to repeat each of the geoprocessing operations for each row, the problem is how do i determine the no of rows? the no of rows would not be fix it can change. Your suggestions would be highly appreciated.
... View more
09-13-2012
10:39 AM
|
0
|
0
|
2379
|
|
POST
|
move the buffer-function into the loop. The result will be a shapefile for every single row. If your Plot_No-Field contains non-unique values you should mention marks answer. Thanks that did it!
... View more
09-11-2012
12:20 AM
|
0
|
0
|
2379
|
|
POST
|
Thanks for your response, but after trying the code it returns only 1 feature? and i want it to return a 15meters buffer for all the records >>> fc = "Parcels"
>>> field = "Plot_No"
>>> shapefieldname = "Shape"
>>> cursor = arcpy.SearchCursor(fc)
>>> for row in cursor:
... feat = row.getValue(shapefieldname)
... val = row.getValue(field)
... outFC = str(val) + "_Buffer" + ".shp"
...
>>> arcpy.Buffer_analysis(feat , outFC, "15 meters", "FULL", "ROUND", "NONE")
<Result 'C:\\Users\\Administrator\\Documents\\ArcGIS\\8_Buffer.shp'> What is wrong?
... View more
09-10-2012
12:35 PM
|
0
|
0
|
2379
|
|
POST
|
Re: How can i use a arcpy script to get the login name of the system user
... View more
09-09-2012
12:41 AM
|
0
|
0
|
750
|
|
POST
|
Im Trying to use a loop to create seperate buffers for each of the row from attribute values of a field in a feature using searchcursor, but its not working the code i used is below; mxd = arcpy.mapping.MapDocument("Current") df = arcpy.mapping.ListDataFrames(mxd)[0] fc = "Parcels" field = "Plot_No" cursor = arcpy.SearchCursor(fc) for row in cursor: val = row.getValue(field) for val in fc: outFC = str(val) + "_Buffer" + ".shp" arcpy.Buffer_analysis(str(val),outFC,"15 meters","FULL","ROUND","NONE") The error message Runtime error Traceback (most recent call last): File "<string>", line 3, in <module> File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\analysis.py", line 687, in Buffer raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Features: Dataset K does not exist or is not supported Failed to execute (Buffer). Please what im i doing wrong? Thanks
... View more
09-08-2012
03:30 PM
|
0
|
8
|
3688
|
|
POST
|
How cam i use a arcpy script to get the login name of the system user and use the name to pupolate a field in a feature attribute table?
... View more
09-07-2012
09:00 PM
|
0
|
3
|
1451
|
|
POST
|
is it possible to add an arcpy progress bar script to an arcpy script which is not a python script tool i.e an arcpy script that is the code behinde an ArcGIS addin_assistant script? Any suggestion(s)?
... View more
09-07-2012
08:53 PM
|
0
|
2
|
4106
|
|
POST
|
Thanks i got a workaround for it; let me share my code arcpy.SelectLayerByLocation_management("Parcels", "COMPLETELY_WITHIN", "ClipFeature", "", "NEW_SELECTION") fc = "Parcels" field = "OBJECTID" cursor = arcpy.SearchCursor(fc) for row in cursor: val = row.getValue(field) print (row.getValue(field)) mxd = arcpy.mapping.MapDocument("current") lyr = arcpy.mapping.ListLayers(mxd, "Lines_Clip")[0] for lblClass in lyr.labelClasses: lblClass.SQLQuery = '"ParcelID"' + "=" + str(val) arcpy.SelectLayerByAttribute_management("Parcels", "CLEAR_SELECTION")
... View more
09-07-2012
06:27 PM
|
0
|
0
|
465
|
|
POST
|
Thank you Today, JSkinn3 i discovered yesterday while reading an ESRI White paper. Thanks a bunch
... View more
09-07-2012
04:59 PM
|
0
|
0
|
434
|
|
POST
|
I want to use the concurrent editing senario, but i cant even get 2 users to edit the default geodatabase, iv enabled the versioning and i get the error that only 1 user can edit a personal ArcSDE Geodatabase at a time. What can i do?
... View more
09-06-2012
06:37 PM
|
0
|
2
|
2659
|
|
POST
|
Thanks i think i got it fc = 'Database Connections/Connection to GISSERVER.sde/GISMAIN.DBO.GIS_Parcels' workspace = os.path.dirname(fc) edit = arcpy.da.Editor(workspace) edit.startEditing(True) edit.stopEditing(True)
... View more
09-02-2012
06:19 AM
|
0
|
0
|
1586
|
|
POST
|
How can i start the edit session for a layer warehoused in an ArcSDE geodatabase, I have moved my geodatabase to an ArcSDE geodatabase and ive been trying to start editing and it is giving me the error below; Please how do i go about this. Thanks gds = r"C:/Users/Administrator/AppData/Roaming/ESRI/Desktop10.1/ArcCatalog/GISSERVER_SQLEXPRESS.gds/KWAGISMAIN"
edit = arcpy.da.Editor(gds)
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
RuntimeError: cannot open workspace
... View more
09-02-2012
05:00 AM
|
0
|
0
|
2584
|
|
POST
|
I want to label a layer using SQL Query i.e a Primary and Foreign Key, the primary key field is the OBJECTID in the polygon layer while the ParcelID is the Foreign Key field in the Line_Clip layer. Below is my script but it is not working; import arcpy mxd = arcpy.mapping.MapDocument("Current") lyr = "Lines_Clip" lyr1 = "Parcels_Clip" field1 = "OBJECTID" field2 = "ParcelID" for lyr in arcpy.mapping.ListLayers(mxd): if lyr.supports("LABELCLASSES"): if lyr.showLabels: where "ParcelID" = "OBJECTID" What im i doing wrong? Thanks
... View more
08-31-2012
05:13 PM
|
0
|
2
|
582
|
|
POST
|
I want to pass the selection query below for a layer in my Geodatabase, how can i get i to be like the second query, the 1st 1 is not working; arcpy.SelectLayerByAttribute_management("Parcels", "NEW_SELECTION", '"TDPDetails"' + "=" + "'" + selection + "'") arcpy.SelectLayerByAttribute_management("Parcels", "NEW_SELECTION", [TDPDetails] + "=" + "'" + selection + "'") How can i replace "TDPDetails" with [TDPDetails]? Thanks
... View more
08-31-2012
11:29 AM
|
0
|
0
|
2584
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-19-2015 08:49 AM | |
| 1 | 10-15-2013 04:42 AM | |
| 1 | 09-20-2016 03:45 AM | |
| 2 | 09-25-2016 03:50 PM | |
| 1 | 08-25-2012 09:15 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|