POST
|
Hi all! I would like to create a zoning plan for a wildlife reserve. The zoning must be done according to the feature attributes of the planning units (polygons) within my study area. I would like to know if there is a tool in ArcGIS Pro that would allow me to cluster the planning unit polygons to create multi-use zoning based on values and costs. For the moment I thought about Multivariate Clustering (link) and Optimized Hot Spot Analysis (link). However, I don't know if these tools allow integrating costs to be considered in clustering as the Least Cost Path function does. I'm open to any suggestions! Thanks
... View more
07-06-2023
03:49 PM
|
0
|
0
|
237
|
POST
|
The error was that I didn't double back slashed the path of my file output. Thanks everyone.
... View more
08-21-2018
08:36 AM
|
1
|
0
|
1817
|
POST
|
Thanks, The Table to Excel tool works perfectly from the toolbox/model builder. However, if I export the script generated from the Model and try to incorporate it in my Script Tool it doesn't work.
... View more
08-21-2018
05:26 AM
|
0
|
0
|
1817
|
POST
|
Good day everyone, I've used the table to excel tool in model builder but now I want to have it in a form of a python script. Using the ESRI Table to Excel Help paged and I ended up with this. # Run the Intersect analysis Input_Table = arcpy.Intersect_analysis([IntersectFeature, AreaOfInterest], SpecifiedSites, "ALL", "", "INPUT") # Report a success message arcpy.AddMessage("Intersect analysis made!") #Process: Export to CSV table arcpy.TableToExcel_conversion(Input_Table, wrk+"\Ouput_Excel_File.xls", "NAME", "CODE") # Report a success message arcpy.AddMessage("Results exported to a Excel file!") The intersect analysis works fine but the conversion failed to execute. Here's the specific error message: Running script TableToExcel... Failed script TableToExcel... Traceback (most recent call last): File "c:\program files (x86)\arcgis\desktop10.2\ArcToolbox\Scripts\TableToExcel.py", line 222, in <module> arcpy.GetParameter(3)) File "c:\program files (x86)\arcgis\desktop10.2\ArcToolbox\Scripts\TableToExcel.py", line 216, in table_to_excel workbook.save(output) File "C:\Python27\ArcGIS10.2\lib\site-packages\xlwt\Workbook.py", line 662, in save doc.save(filename, self.get_biff_data()) File "C:\Python27\ArcGIS10.2\lib\site-packages\xlwt\CompoundDoc.py", line 261, in save f = open(file_name_or_filelike_obj, 'w+b') IOError: [Errno 2] No such file or directory: u'C:\\Users\\pierrej\\Desktop\\GISData\\Ouput_Excel_File.xls'
... View more
08-13-2018
07:25 AM
|
0
|
6
|
4157
|
POST
|
The extra pair of single quotes gave me a SQL syntax error, so I removed them. This is the code that ended up working but only for numeric fields: try: # Get the input parameters for the Selection Tool FClass = arcpy.GetParameterAsText(0) Field = arcpy.GetParameterAsText(1) Feature = arcpy.GetParameterAsText(2) where_clause = """{} = {}""".format(arcpy.AddFieldDelimiters(FClass, Field),Feature) # I have added extra pair of single quotes for selecting strings arcpy.AddMessage(where_clause) # Select the site arcpy.SelectLayerByAttribute_management(FClass,"NEW_SELECTION", where_clause) # write selected features to a new featureclass arcpy.CopyFeatures_management(FClass, "SelectionSites") #Zooming to a selection set for the specific layer df.zoomToSelectedFeatures() arcpy.RefreshActiveView() # Report a success message arcpy.AddMessage("All done!") However, if I try the tool using a String type field I get an error message. (Invalid expression, and invalid SQL statement was used)
... View more
07-11-2018
12:12 PM
|
0
|
0
|
8005
|
POST
|
# Get the input parameters for the Selection Tool FClass = arcpy.GetParameterAsText(0) Field = arcpy.GetParameterAsText(1) Feature = arcpy.GetParameterAsText(2) # Make a layer from the feature class FclassLayer = arcpy.MakeFeatureLayer_management(FClass,"FclassLayer") where_clause = """{} = {}""".format(arcpy.AddFieldDelimiters(FclassLayer, Field),Feature) arcpy.AddMessage(where_clause) # Select the site arcpy.SelectLayerByAttribute_management(FclassLayer,"NEW_SELECTION", where_clause) # write selected features to a new featureclass arcpy.CopyFeatures_management(FclassLayer, "SelectionSites") I attributed the layer to a variable called FclassLayer to get rid of the quotation marks. The script still ran but didn't select anything.
... View more
07-11-2018
11:11 AM
|
0
|
0
|
8005
|
POST
|
Hello Darren, 'Feature' would be the FID #, or the province name for example. The user enters his feature class layer, specifies the field and enters the field value for the feature we're looking for.
... View more
07-11-2018
11:09 AM
|
0
|
0
|
8005
|
POST
|
Hello everyone, I'm trying to program a simple Select by Attributes Python script tool. I want to be able to find a specific building using a field and zoom in to the location. Also, my tool needs to allow the user to input any field or any value. So far this is what I got. import arcpy #Set to current mxd and dataframe mxd = arcpy.mapping.MapDocument ('CURRENT') df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0] # Set overwrite option arcpy.env.overwriteOutput = True arcpy.env.workspace ="C:\Users\pierrej\Desktop\GIS Data" try: # Get the input parameters for the Selection Tool FClass = arcpy.GetParameterAsText(0) Field = arcpy.GetParameterAsText(1) Feature = arcpy.GetParameterAsText(2) # Make a layer from the feature class arcpy.MakeFeatureLayer_management(FClass,"FclassLayer") where_clause = """{} = {}""".format(arcpy.AddFieldDelimiters("FclassLayer", Field),Feature) arcpy.AddMessage(where_clause) # Select the site arcpy.SelectLayerByAttribute_management("FclassLayer","NEW_SELECTION", where_clause) # write selected features to a new featureclass arcpy.CopyFeatures_management("FclassLayer", "SelectionSites") #Zooming to a selection set for the specific layer df.zoomToSelectedFeatures() df.scale = 2500000 arcpy.RefreshActiveView() # Report a success message arcpy.AddMessage("All done!") except: # Report an error messages arcpy.AddError("Could not complete") # Report any error messages that the tool might have generated arcpy.AddMessage(arcpy.GetMessages()) My parameters are the following: InputFeatureClass = Data Type: Feature Layer, Required, Input, No Multivalue InputField = Data Type: Field, Required, Input, No Multivalue, Obtained from Input Feature Class InputValue = DataType: String, Required, No Multivalue The script runs and I don't have any error message but the tool doesn't select any thing. How can I fix this?
... View more
07-11-2018
08:50 AM
|
0
|
6
|
16209
|
Title | Kudos | Posted |
---|---|---|
1 | 08-21-2018 08:36 AM |
Online Status |
Offline
|
Date Last Visited |
11-27-2023
03:03 PM
|