|
POST
|
Thanks Dan, it's really good, but what i need is a button to loop through attributes, manually edit something (like insert in attribute table a 1 for error and 0 for no error) and loop to the next? Is this possible? This is what I have so far, but how to stop the loop after each for statement and restart in python the place I left the loop?
import arcpy
import os
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "")[0]
SelLayer = arcpy.mapping.ListLayers(mxd, "Aenderung_MToS_6417341", df)[0]
for row in arcpy.SearchCursor(SelLayer):
df.extent = row.SHAPE.extent #Set the dataframe extent to the extent of the feature
df.scale = df.scale * 1.07 #Optionally give the shape a bit of padding around the edges
arcpy.RefreshActiveView()
#Put in your export here
... View more
10-20-2014
04:15 AM
|
0
|
3
|
1787
|
|
POST
|
Maybe this could help you? ArcGIS Help 10.1 arcgis - Water Flow Analysis - Geographic Information Systems Stack Exchange
... View more
10-17-2014
02:29 AM
|
1
|
0
|
1551
|
|
POST
|
10-16-2014
07:40 AM
|
0
|
0
|
726
|
|
POST
|
If I use lyrname.encode('utf-8') This leads to: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128) ???
... View more
10-16-2014
04:40 AM
|
0
|
1
|
1385
|
|
POST
|
This:
import arcpy
import os
mxd = arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.supports("DATASOURCE"):
arcpy.AddMessage("Layer: " + lyr.name + " Source: " + lyr.dataSource)
for lyr in arcpy.mapping.ListLayers(mxd):
lyrname = str(lyr.name)
print lyrname
lyrname_replaced = lyrname.replace(" ","_")
lyr.name = lyrname_replaced
arcpy.AddMessage(lyrname_replaced)
arcpy.RefreshTOC()
leads to this error: File "R:\Karto\zGIS\Python\RenameLayerinMxd.py", line 16, in <module> lyrname = str(lyr.name) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 3: ordinal not in range(128) Any ideas?
... View more
10-16-2014
04:18 AM
|
0
|
2
|
1385
|
|
POST
|
import arcpy import os input = arcpy.GetParameterAsText(0) clipfeature = arcpy.GetParameterAsText(1) output = arcpy.GetParameterAsText(2) clipfeature_Layer = "clipfeature_Layer" arcpy.env.workspace = output arcpy.env.overwriteOutput = True field = "BFN_Nummer" inputSp = input.split(";") # arcpy.MakeFeatureLayer_management(clipfeature, clipfeature_Layer, "", "", "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;BFN_NUMMER BFN_NUMMER VISIBLE NONE") arcpy.MakeFeatureLayer_management(clipfeature, clipfeature_Layer, "", "", "") cursor = arcpy.SearchCursor(clipfeature) for row in cursor: print(row.getValue(field)) Loop1 = row.getValue(field) quercy = field + "=" + "'" + Loop1 + "'" arcpy.SelectLayerByAttribute_management (clipfeature_Layer, "NEW_SELECTION", quercy) Sel_shape = "Sel_" + Loop1 + ".shp" arcpy.CopyFeatures_management(clipfeature_Layer, Sel_shape) for i in inputSp: arcpy.AddMessage(i) arcpy.Clip_analysis(i, Sel_shape, "Clip_" + row.getValue(field) + "_" + i)
... View more
10-15-2014
03:01 AM
|
0
|
0
|
849
|
|
POST
|
This script only clips on of the selected features? What's wrong?
import arcpy
import os
input = arcpy.GetParameterAsText(0)
clipfeature = arcpy.GetParameterAsText(1)
output = arcpy.GetParameterAsText(2)
arcpy.env.workspace = output
# fc = "R:\Karto\Bierer2014\FFH_Ausschreibung2014\FFH_Merge_Buffer1.shp"
field = "BFN_Nummer"
inputSp = input.split(";")
cursor = arcpy.SearchCursor(clipfeature)
for row in cursor:
print(row.getValue(field))
for i in inputSp:
arcpy.AddMessage(i)
arcpy.Clip_analysis(i, clipfeature, i + "_" + row.getValue(field))
... View more
10-15-2014
01:08 AM
|
0
|
2
|
1234
|
|
POST
|
The best is to create a model with select by attribute - then export the model to python and modificate the python code with the for i in range command?
... View more
10-14-2014
01:23 AM
|
0
|
1
|
2200
|
|
POST
|
With python: for i in range(102, "End", 2): print i
... View more
10-14-2014
12:54 AM
|
0
|
1
|
2200
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-10-2025 08:08 AM | |
| 1 | 05-13-2025 05:05 AM | |
| 1 | 04-28-2025 03:40 AM | |
| 4 | 08-13-2024 10:49 PM | |
| 1 | 08-13-2024 09:52 PM |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|