POST
|
Never mind, I fixed it. Python and arcgis need every detail to be correct.... codes: # Create the Geoprocessor import arcgisscripting, sys, string, os gp = arcgisscripting.create() gp.workspace = "C:/pro" # Load required toolboxes gp.AddToolbox("C:/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx") try: # Process: Find all stream crossings (points) #gp.Intersect_analysis("county.shp ; road.shp ", "copyfeature.shp", "#", "", "line") #Select all polygon that overlap the lines gp.SelectLayerByLocation_management("county", "INTERSECT", "road") # Within the selection (done above) further select only those attributes satisfy some requirement gp.SelectLayerByAttribute_management("county", "NEW_SELECTION", "Shape_Area > 14954576441") # Write the selected features to a new feature class gp.CopyFeatures_management("county", "C:/pro/copyfeature.shp") except: # If an error occurred, print the message to the screen print gp.GetMessages()
... View more
09-12-2011
08:48 PM
|
0
|
0
|
80
|
POST
|
I cannot can the selectbylocation's result. When I just run copyfeature, it gets output. But if I add selectbylocation or select by attribute, nothing export. Codes: # Create the Geoprocessor import arcgisscripting, sys, os gp = arcgisscripting.create() gp.workspace = "C:\pro" # Load required toolboxes gp.AddToolbox("C:\ArcGIS\ArcToolbox\Toolboxes\Data Management Tools.tbx") try: #Select all polygon that overlap the lines gp.SelectLayerByLocation_management("county.shp", "INTERSECT", "road.shp","", "NEW_SELECTION") # Within the selection (done above) further select only those attributes satisfy some requirement #gp.SelectLayerByAttribute_management("county.shp", "[area] > 13862709075", "road.shp") # Write the selected features to a new feature class gp.CopyFeatures_management("county.shp", "C:\pro\copyfeature.shp") except: # If an error occurred, print the message to the screen print gp.GetMessages() Anyone know why this is happening?
... View more
09-12-2011
07:09 PM
|
0
|
1
|
413
|
POST
|
It would be quite useful to have a feature where the user can input a start point and driving time, and then highlight all areas within that driving distance. IE what is within three hours drive from portland, OR? I am staying at this address in San Francisco. What is within 45 mins walking distance?
... View more
09-02-2011
11:56 AM
|
0
|
1
|
1781
|
POST
|
How about this? # Create the Geoprocessor object import arcgisscripting gp = arcgisscripting.create() # Load required toolboxes gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management.tbx") # Set the workspace (to avoid having to type in the full path to the data every time) gp.Workspace = "C:\temps" Input_Features = sys.argv[1] Select_features= sys.argv[2] try: # Select intersect polygons gp.SelectLayerByLocation("Input_Features", "intersect", "Select_features") # Write the selected features to a new feature class gp.CopyFeatures("Input_Features", "C:\temps\result.shp") except: # If an error occurred, print the message to the screen print gp.GetMessages() ////////////////////////////////////////////////////////////////////////////////////// But when I try to run it, an error sign still pop up: <type 'exceptions.IndentationError'>: ERROR 999999: Error executing function Failed to execute (Intersect).
... View more
08-31-2011
12:50 PM
|
0
|
0
|
253
|
POST
|
My mission is to select some polygons by location ( intersect with existing lines), and then export the result as a new shape file layer. I have been trying different ways and search for helps but it ended to nothing yet. So please help if you know. Following is my current codes: # Import system modules import sys, string, os, arcgisscripting # Create the Geoprocessor object gp = arcgisscripting.create() # Load required toolboxes gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management.tbx") try: # Set the workspace (to avoid having to type in the full path to the data every time) gp.Workspace = "C:\temp" gp.overwriteOutput = 1 outFolder = r???C:\Temp??? outFile = ???Polygon.shp??? gp.workspace = outFolder gp.CreateFeatureClass (outFolder, outFile, ???Polygon???, ???#???,???#???,???#???, "#") # Script arguments... Output_Feature_Class = outFile Input_Features = sys.argv[1] # Process: Find all stream crossings (points) gp.SelectLayerByLocation(Input_Features, "intersect", Output_Feature_Class) except: # If an error occurred while running a tool, print the messages. print gp.GetMessages()
... View more
08-29-2011
12:35 PM
|
0
|
2
|
493
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|