|
POST
|
Could you please let me know what messages you get when you wrap your Make Feature Layer line with try-except as follows? try:
arcpy.MakeFeatureLayer_management(Watersheds_from_LiDAR, "watershed_lyr")
except:
print arcpy.GetMessages(2)
arcpy.AddMessage(arcpy.GetMessages(2))
... View more
06-08-2012
04:03 PM
|
0
|
0
|
1362
|
|
POST
|
This is a duplicate thread. Please remove one of the identical threads to avoid confusion.
... View more
06-08-2012
06:28 AM
|
0
|
0
|
324
|
|
POST
|
After you run Convert Coordinate Notation, use its output as input to Minimum Bounding Geometry (Data Management > Features) with these parameter values: Geometry Type: ENVELOPE Group Option: ALL It will create a rectangle as output. You can then describe the output to get the extent: ext = arcpy.Describe("output_envelope").Extent
xmin = ext.XMin
ymin = ext.YMin
...
... View more
06-08-2012
06:25 AM
|
0
|
0
|
611
|
|
POST
|
Use raw_input to get user input in command line: in_txt = raw_input('Enter your value :')
... View more
06-07-2012
08:30 PM
|
1
|
0
|
7158
|
|
POST
|
Group Layer does not have any path - so you cannot change its path. Whenever, you encounter a group layer, skip it as in this code snippet: if layer.isGroupLayer: pass # skip else: #replace data path It will be easier to read your code if you copy-paste them within CODE tags (click on the hash symbol to get tags). There is a simple sample here: import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd") for lyr in arcpy.mapping.ListLayers(mxd): if lyr.supports("DATASOURCE"): if lyr.dataSource == r"C:\Project\Data\Parcels.gdb\MapIndex": lyr.findAndReplaceWorkspacePath(r"Data", r"Data2") mxd.saveACopy(r"C:\Project\Project2.mxd") del mxd Here is the topic: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Updating_and_fixing_data_sources_with_arcpy_mapping/00s30000004p000000/
... View more
06-07-2012
06:56 AM
|
0
|
0
|
2317
|
|
POST
|
Hi Luke, I'm not sure whether you can filter a particular type (extension) of files through IGPFileDomain 😞 I'm away this week - hope to give you a definitive answer next week. Meanwhile, you can post your question to ArcGIS > Products > ArcObjects > All Development Languages forum also. Thanks, Nobbir Esri Geoprocessing Team.
... View more
06-06-2012
11:32 PM
|
0
|
0
|
427
|
|
POST
|
Could you please show the full statement for this line? arcpy.SelectLayerByLocation_management( ???, ??? ....) Another question, what do you mean by 'point attributes' when you say ".... add the selected point attributes to the PDF.."? Assuming, by "attributes" you mean the point features themselves, I suggest use these steps before exporting to PDF: # assuming you have only one data frame
df = arcpy.mapping.ListDataFrames(mxd)[0]
df.zoomToSelectedFeatures()
# clear selection - otherwise, the PDF will contain selection color
arcpy.SelectLayerByAttribute_management("state_centroids", "CLEAR_SELECTION")
... View more
06-06-2012
02:42 PM
|
0
|
0
|
827
|
|
POST
|
You cannot pop up your own messages/boxes in 10.0 😞 However, you can add the script tool to your toolbar from Customize > Customize Mode ... > Commands tab - see the screenshot below: [ATTACH=CONFIG]14993[/ATTACH] In your script, you can add messages using the arcpy.AddMessage(..) and/or arcpy.AddError(..) calls.
... View more
06-06-2012
12:23 PM
|
0
|
0
|
1666
|
|
POST
|
Does anyone know why Python would add an underscore to a field name!? Could you please do the 'Add Field' process manually with the tool itself from ArcToolbox and see whether you still get the field name with an underscore?
... View more
06-05-2012
10:28 AM
|
0
|
0
|
2452
|
|
POST
|
Use Python csv module - it will make your life easier - see below 🙂 import csv
# Reads a base table and outputs Feature Class and Layer Lists
readTable = csv.reader(open("C:/Users/atimpson/Desktop/ScriptTable/BPWorksLayers.csv", "rb")
# Read the first line
first_line = readTable.next()
## comment out these two lines
#headerLine = readTable.readline()
#valueList = headerLine.split(",")
fcPos = first_line.index("Feature Class")
lyrPos = first_line.index("Layers")
# Read lines in the file and append to comparison lists
baseFeature = []
baseLayer = []
# now read second line and on ..
for line in readTable:
# make sure current line has as many items as the first line has
if len(line) >= len(first_line):
baseFeature.append(line[fcPos])
baseLayer.append(line[lyrPos])
... View more
06-05-2012
09:50 AM
|
0
|
0
|
941
|
|
POST
|
Looks like a simpler and better solution already exists in the standard module (pointed out by Jason Scheirer of Esri Geoprocessing team). # itertools standard module's combinations function does it clearly import itertools for point1, point2 in itertools.combinations(pointsList, 2): print point1.X, point2.X There is no need to create a duplicate list and iterate over two lists.
... View more
06-04-2012
10:55 PM
|
0
|
0
|
1167
|
|
POST
|
Sorry to hear that. To prepare a workaround I need your data and detail steps you are trying - email me at nahmed@esri.com
... View more
06-04-2012
02:58 PM
|
0
|
0
|
589
|
|
POST
|
Try Calculate Field gp tool. Extract the product ID from map document's name and set it to the ProductID field. Follow this topic if you need help: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Calculate_Field/00170000004m000000/
... View more
06-03-2012
11:06 PM
|
0
|
0
|
1194
|
|
POST
|
Modify the last loop as follows: # make a duplicate of the original point list
tempPointList = pointList[:]
for point1 in pointsList:
# remove the current point from the temp list
tempPointList.remove(point1)
for point2 in tempPointList:
# point1 and point2 to make a pair
print (point1.X, point2.X)
... View more
06-03-2012
10:57 PM
|
0
|
0
|
1167
|
|
POST
|
Your output data is: outdata=os.path.normpath(ConversionUtils.gp.GetParameterAsText(1)+path) You are using the same outdata variable in your repeated call to Project tool: ConversionUtils.gp.SetProgressorLabel(ConversionUtils.gp.GetIDMessage(86113) + input)
ConversionUtils.gp.Project_management(input, outdata, sr, transformation)
In between, you have commented out this line: outdata = ConversionUtils.GenerateOutputName(input, output_workspace) What GenerateOutputName function does is, checks whether the an output with the same exists and if so, creates a new name by appending an underscore and a number at the end of the name. As you are using the same name, Project tries to overwrite the same output when it runs 2nd time and on. Try setting the overwrite output to True and see whether you get the same error. I guess you'll get only one output. If you don't want to (or having trouble) use the commented out line, my suggestion would be modify your code as follows: index = 1
for input in inputs:
try:
outdata = outdata + "_" + str(index)
.....
ConversionUtils.gp.Project_management(input, outdata, sr, transformation)
...
...
index += 1 Remember that instead of using GenerateOutputName, if you go for my suggested code, and you run your code again then the output generated in your first run will be overwritten.
... View more
06-01-2012
11:46 AM
|
0
|
0
|
579
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 12-18-2019 03:56 PM | |
| 1 | 05-06-2020 01:18 PM | |
| 1 | 07-23-2021 10:33 AM | |
| 1 | 07-28-2020 09:10 AM | |
| 2 | 07-27-2020 04:47 PM |
| Online Status |
Offline
|
| Date Last Visited |
10-25-2021
03:13 PM
|