POST
|
I would like to Eliminate an area smaller than 15000 sq meters in all layers. Example files attached. Dropbox - ElimSampleFiles.gdb.zip Thanks, Phoukhong
... View more
10-25-2015
09:26 PM
|
0
|
0
|
585
|
POST
|
I have seen the Eliminate Help and copied the ...Example2.py However, I want to process a list of layers or feature layers and do not knowhow to use Phyton or arcpy correctly. I try to use this but no success!!! fcList = arcpy.ListFeatureClasses("P*","POLYGON") for fc in fcList: MakeFeatureLayer... Select... Eliminate... So, it process only the last layer in the fcList. Any idea? Thank you so much! Phoukhong
... View more
10-25-2015
09:12 PM
|
0
|
2
|
585
|
POST
|
How to process with a list of files using [arcpy.ListFeatureClasses] with script below? Any help from you all very appreciate! try:
fcList = arcpy.ListFeatureClasses("P*","POLYGON")
fcList.sort()
print fcList
fcCount = len(fcList)
print fcCount
for fcs in fcList:
print "Selecting areas < 1ha from file: " + fcs
eliminate_file = fcs + "_elim"
arcpy.SelectLayerByAttribute_management(fcs,"NEW_SELECTION", expres)
arcpy.Eliminate_management(fcs, eliminate_file, "AREA", "", "" )
except:
print "Could not create feature layers" ****** This is from: # Name: Eliminate_Example2.py
# Description: Eliminate features based on a selection.
# Import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = "C:/data/Portland.gdb/Census"
# Set local variables
inFeatures = "blockgrp"
tempLayer = "blocklayer"
expression = '"Area_Sq_Miles" < 0.15'
outFeatureClass = "C:/output/output.gdb/eliminate_output"
exclusionExpression = '"OBJECTID" = 9'
# Execute MakeFeatureLayer
arcpy.MakeFeatureLayer_management(inFeatures, tempLayer)
# Execute SelectLayerByAttribute to define features to be eliminated
arcpy.SelectLayerByAttribute_management(tempLayer, "NEW_SELECTION", expression)
# Execute Eliminate
arcpy.Eliminate_management(tempLayer, outFeatureClass, "LENGTH",
exclusionExpression) Message was edited by: Dan Patterson I moved this to geoprocessing and used syntax highlighting >> to format the code
... View more
10-23-2015
02:16 AM
|
0
|
4
|
2758
|
POST
|
I tried it but not working. The auto increment sorted by OBJECT_ID is okay but no condition! Pre-Logic Script Code: rec=0 def autoIncrement(): global rec pStart = 1 #adjust start value, if req'd pInterval = 2 #adjust interval value, if req'd if (rec == 0): rec = pStart else: rec = rec + pInterval return rec Expression: autoIncrement()
... View more
08-19-2015
08:57 PM
|
0
|
0
|
452
|
POST
|
I tried it but not working. The auto increment sorted by OBJECT_ID is okay but no condition! Pre-Logic Script Code: rec=0 def autoIncrement(): global rec pStart = 1 #adjust start value, if req'd pInterval = 2 #adjust interval value, if req'd if (rec == 0): rec = pStart else: rec = rec + pInterval return rec Expression: autoIncrement()
... View more
08-19-2015
08:32 PM
|
0
|
0
|
452
|
POST
|
In Excel, I can do: In cell B2 =IF(A2=A1, B1+1,1) Data in A1:A20 A B 1 1 1 =IF(A2=A1, B1+1,1) 1 2 2 2 2 3 3 ... How can I do in ArcGIS Attribute Table using field calculator? I use the AutoIncreament() ... but it work according to the OBJECT_ID and that is not CONDITIONAL... Your help is very appreciate! Khong
... View more
08-18-2015
10:06 PM
|
0
|
4
|
3262
|
POST
|
So much time spent and found it here. However, space, indent ...etc. enter.... is challenges! import os, arcpy, arcpy.mapping from arcpy import env mxd = arcpy.mapping.MapDocument("Current") lstas = arcpy.mapping.ListLayers(mxd,"*.img") for las in lstas: arcpy.ApplySymbologyFromLayer_management (las, r"C_RE.lyr\20101105t045002_01_or_mo.img")
... View more
08-16-2014
10:39 AM
|
0
|
0
|
466
|
POST
|
Hi friends, Please help me how to set Layer properties/Symbology/Display back ground value RGB to value 0 0 0 for all 200 raster files in once with python command? I tried to use arcpy.SetRasterProperties_management but this is not the correct one. Thank you in advance!
... View more
08-16-2014
05:46 AM
|
0
|
2
|
4908
|
Online Status |
Offline
|
Date Last Visited |
10-07-2023
08:11 AM
|