|
POST
|
Hi Richard, You can use a mosaict dataset as input to a geoprocessing tool, so you would be able to perform the clip. Here is some more information: http://resources.arcgis.com/en/help/main/10.1/index.html#/Using_mosaic_datasets_and_image_services_in_analysis_and_geoprocessing/009t000001z0000000/
... View more
08-14-2012
12:09 PM
|
0
|
0
|
1770
|
|
POST
|
Hi Irene, You can accomplish this using the 'glob' module. Ex: import arcpy, glob
GDB = r"C:\temp\Python\CAD\CAD_DATA.gdb"
reference_scale = "500"
# Find all DWG files
for file in glob.glob(r"C:\temp\python\CAD\*.dwg"):
# Convert all DWG files to GDB feature classes
arcpy.CADToGeodatabase_conversion(file, GDB, file.split("\\")[-1][0:-4], reference_scale) The 'file.split("\\")[-1][0:-4]' will split the path of the CAD file for each backslash (\), use the last value found by specifying [-1] (which would be the CAD file name), and then strip the '.DWG' from the file name by specifying [0:-4].
... View more
08-08-2012
01:04 PM
|
0
|
0
|
6769
|
|
POST
|
I was incorrect before, the 'field_info' parameter for the MakeFeatureLayer_management function will hide fields. See the description of this parameter here. This is why you cannot find any fields when you iterate through the feature layer using a cursor. However, this doesn't explain why the 'desc.fieldInfo.count' method returns the number of fields that you specify to be hidden, and not the ones that are visible. This may be a bug.
... View more
08-08-2012
06:52 AM
|
0
|
0
|
2564
|
|
POST
|
Hi Veronica, You could do something like the following: def Reclass(FIELD_1, FIELD_2): if FIELD_1 == 1 or FIELD_1 == 2 or FIELD_1 == 4: if (FIELD_2 < 92): return 0 elif (FIELD_2 >= 92 and FIELD_2 < 93.5): return 1 elif (FIELD_2 >= 93.5): return 2 elif FIELD_1 == 3 or FIELD_1 == 5 or FIELD_1 = 7: <other code>
... View more
08-08-2012
05:09 AM
|
0
|
0
|
1330
|
|
POST
|
Hi Jose, If you are using ArcGIS/ArcSDE 10, create a new field with your desired field name and then calculate the old field to the new field using the field calculator. At 10.1, you can rename the field in ArcCatalog > feature class Properties > Fields tab. See more information under 'Renaming Fields' here.
... View more
08-08-2012
04:46 AM
|
0
|
0
|
553
|
|
POST
|
A cursor is used to iterate through a table or feature class. If you want to describe a feature class, this should not be executed within cursor, because it will describe the feature class for each row within the cursor (which would be overkill). If there are 10,000 rows, you would be describing the feature class 10,000 times. If you want to verify that the UpdateCursor is only using the fields you specified within the cursor, try printing a field that you did not specify. For example: rows = arcpy.UpdateCursor(fc, "", "", "FCC; LOC_ID")
for row in rows:
print row.NAME
del rows, row I did not specify the field 'NAME' for my cursor, but this field does exist. When I print the values for this field I receive 'None' rather the field value.
... View more
08-08-2012
04:36 AM
|
0
|
0
|
2564
|
|
POST
|
Hi Bartek, If you are trying to calculate the X coordinate of the features first point in the field calculator you will need to update your code slightly: !Shape!.firstPoint.X
... View more
08-08-2012
04:11 AM
|
0
|
0
|
824
|
|
POST
|
1) The fields set within the cursor will only apply when iterating through the cursor object. To limit the fields you will need to set this within the MakeFeatureLayer_management function. Ex: fc = "Hospitals"
layer = "temp_layer"
arcpy.MakeFeatureLayer_management(fc, layer, "", "", "STATE_NM; LINK_ID")
desc = arcpy.Describe(layer)
fieldInfo = desc.fieldInfo
print "Field Count =", fieldInfo.count 2) Yes, this should be possible. Try the following: a = 1
ChangingField = "CmpltFlg_" + str(a)
cur1 = arcpy.UpdateCursor("InputLyr","","","UnqRecordI; UnqWellLoc;" + ChangingField)
... View more
08-07-2012
08:42 AM
|
0
|
0
|
2564
|
|
POST
|
Hi Abby, You will need to remove the brackets around the fields parameter, only use one set of quotation marks, and separate each field with a semicolon. Ex: cur1 = arcpy.UpdateCursor("InputLyr", "", "", "UnqRecordI; UnqWellLoc") Another example can be seen in the Help for the SearchCursor: http://resources.arcgis.com/en/help/main/10.1/index.html#/SearchCursor/018v00000050000000/
... View more
08-07-2012
02:53 AM
|
0
|
0
|
2564
|
|
POST
|
I'm not sure why the feature class is being dropped, but is there a reason you are choosing 'Simple Model' rather than 'Full Model'? For example, do you need the child replica not to be versioned in the SQL Server Express instance? If you choose 'Full Model' both the feature class, attachments table, and the associated relationship class will be replicated. Here is more information on feature information models for replicas.
... View more
08-06-2012
07:42 AM
|
0
|
0
|
2847
|
|
POST
|
Yes, i used it. May be can be more specific where i should put the append, because there are 3 while loops and which one to append ( pnt or pnt.z ). thanks again Looks like I forgot to include the append portion:
while pnt:
# Print x,y coordinates of current point
##print pnt.x, pnt.y, pnt.z
list.append(pnt.z)
pnt = part.Next()
pntcount += 1 So, the entire code I was able to get working is: # Import native arcgisscripting module
#
import arcgisscripting
# Create the geoprocessor object
#
gp = arcgisscripting.create(9.3)
infc = gp.GetParameterAsText(0)
# Identify the geometry field
#
desc = gp.Describe(infc)
shapefieldname = desc.ShapeFieldName
# Create search cursor
#
rows = gp.SearchCursor(infc)
row = rows.Next()
# Enter while loop for each feature/row
#
while row:
list = []
# Create the geometry object
#
feat = row.GetValue(shapefieldname)
# Print the current multipoint's ID
#
print "Feature " + str(row.getvalue(desc.OIDFieldName)) + ":"
partnum = 0
# Count the number of points in the current multipart feature
#
partcount = feat.PartCount
# Enter while loop for each part in the feature (if a singlepart feature
# this will occur only once)
#
while partnum < partcount:
# Print the part number
#
print "Part " + str(partnum) + ":"
part = feat.GetPart(partnum)
pnt = part.Next()
pntcount = 0
# Enter while loop for each vertex
#
while pnt:
# Print x,y coordinates of current point
##print pnt.x, pnt.y, pnt.z
list.append(pnt.z)
pnt = part.Next()
pntcount += 1
# If pnt is null, either the part is finished or there is an
# interior ring
#
if not pnt:
pnt = part.Next()
if pnt:
print "Interior Ring:"
partnum += 1
list.sort()
min = list[0]
max = list[-1]
print min, max
row = rows.Next()
del row, rows
... View more
08-03-2012
12:41 PM
|
0
|
0
|
5318
|
|
POST
|
Did you create the empty list? It's hard to see the bold in the pasted code before. Here is the subset of it: while row: list = []
... View more
08-03-2012
12:04 PM
|
0
|
0
|
5318
|
|
POST
|
Hi Daniel, Are you looking to return only the MIN and MAX Z values? If so, you can create a list, append the Z values to the list, sort the list and then print out the min and max values. Ex: (lines in bold)
# Import native arcgisscripting module
#
import arcgisscripting
# Create the geoprocessor object
#
gp = arcgisscripting.create(9.3)
infc = gp.GetParameterAsText(0)
# Identify the geometry field
#
desc = gp.Describe(infc)
shapefieldname = desc.ShapeFieldName
# Create search cursor
#
rows = gp.SearchCursor(infc)
row = rows.Next()
# Enter while loop for each feature/row
#
while row:
list = []
# Create the geometry object
#
feat = row.GetValue(shapefieldname)
# Print the current multipoint's ID
#
print "Feature " + str(row.getvalue(desc.OIDFieldName)) + ":"
partnum = 0
# Count the number of points in the current multipart feature
#
partcount = feat.PartCount
# Enter while loop for each part in the feature (if a singlepart feature
# this will occur only once)
#
while partnum < partcount:
# Print the part number
#
print "Part " + str(partnum) + ":"
part = feat.GetPart(partnum)
pnt = part.Next()
pntcount = 0
# Enter while loop for each vertex
#
while pnt:
# Print x,y coordinates of current point
##print pnt.x, pnt.y, pnt.z
pnt = part.Next()
pntcount += 1
# If pnt is null, either the part is finished or there is an
# interior ring
#
if not pnt:
pnt = part.Next()
if pnt:
print "Interior Ring:"
partnum += 1
list.sort()
min = list[0]
max = list[-1]
print min, max
row = rows.Next()
... View more
08-03-2012
10:53 AM
|
0
|
0
|
5318
|
|
POST
|
Yes, you can run this script twice. You will just need to update the code to use the C:\ drive.
... View more
08-03-2012
05:19 AM
|
0
|
0
|
2078
|
|
POST
|
What's different with feature 52 than the others? Seems like this feature is causing the rest of the script to fail. Could you send a screen shot of your attribute table (include feature 52 in the screen shot)?
... View more
08-03-2012
03:21 AM
|
0
|
0
|
1698
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 4 | 05-07-2020 05:14 PM | |
| 1 | 03-25-2026 04:16 AM | |
| 1 | 03-16-2026 01:00 PM | |
| 1 | 12-22-2025 10:39 AM |
| Online Status |
Online
|
| Date Last Visited |
12 hours ago
|