|
POST
|
Abby, Don't know if this will help but if you add a selectbylocation tool to model builder fill it in and export it to Python one sees how the tool parameters should be completed. For selectbylocation the distance also includes its units as shown below: arcpy.SelectLayerByLocation_management("layer1","WITHIN_A_DISTANCE", "layer2","100 Meters", "ADD_TO_SELECTION") Still don't get your logic to why you are adding to a selection, for this line you are adding to the selection of "AFOLyr" # Select ancillary layer within 10km...
arcpy.SelectLayerByLocation_management("AFOLyr",SelDist,"Wells2Lyr",10000,SelAddTo) which you then clear with this line: arcpy.SelectLayerByAttribute_management("AFOLyr",SelClear) Duncan
... View more
05-09-2012
06:55 AM
|
0
|
0
|
3476
|
|
POST
|
Abby, I must emphasise Chris's comment about placing your code in the code tags (#) as this makes reading your code easier. This is even more important with Python as indentation is everything! Look at your code you posted how are we to tell when code is outside a loop? Anyway... I have two ideas: Is the code where you clear existing selections outside the For loop? Can't tell as there is no formating... In your selection code arcpy.SelectLayerByLocation_management("AFOLyr",SelDist,"Wells2Lyr",10000,SelAddTo) you are doing a selection and adding it the existing selection. Was that your intention? Are you not trying to do a new selection for each iteration of the cursor? If so replace SelAddTo with SelNew. DUncan
... View more
05-09-2012
12:54 AM
|
0
|
0
|
3476
|
|
POST
|
Are you using the correct name for the model? For this line of code to be correct you need to be using the name not the label of your model. Set pGPTool = pGPToolBox.OpenTool("xxx") In toolbox right click on your model and go to properties. You should be using the model NAME not the LABEL. Duncan
... View more
05-07-2012
07:15 AM
|
0
|
0
|
4608
|
|
POST
|
You need to replace my variable string g_ToolBoxPath with the folder where the tool box is. For example "C:\XYZ\ModelTools"
... View more
05-06-2012
05:11 PM
|
0
|
0
|
4608
|
|
POST
|
Claire, You add a 2 new fields, one for Z and one for M. Then you run the calculate field tool with a simple bit of python that extracts the Z or M value from the point geometry. Look at this page about reading properties of points in python. Duncan
... View more
05-06-2012
05:07 PM
|
0
|
0
|
939
|
|
POST
|
This is going to be painful... EndIf should be (note space) End If Duncan
... View more
05-04-2012
08:58 AM
|
0
|
0
|
6170
|
|
POST
|
Can you post up the script, exactly how you entered it?
... View more
05-04-2012
08:45 AM
|
0
|
0
|
6170
|
|
POST
|
Mohammed, Below is some VBA I used to execute a custom model in a toolbox, this should get you going. Duncan ' Create workspacefactory Dim pToolboxWorkspaceFactory As IWorkspaceFactory Set pToolboxWorkspaceFactory = New esriGeoprocessing.ToolboxWorkspaceFactory 'Open a toolbox workspace Dim pToolboxWorkspace As IToolboxWorkspace Set pToolboxWorkspace = pToolboxWorkspaceFactory.OpenFromFile(g_ToolBoxPath, 0) ' Connect to tool Dim pGPToolBox As IGPToolbox Set pGPToolBox = pToolboxWorkspace.OpenToolbox("WFD49e Processing Tools Enhanced.tbx") Dim pGPTool As IGPTool Set pGPTool = pGPToolBox.OpenTool("mdSubSetFloodplain") ' Run tool Dim pGPToolCommandHelper As IGPToolCommandHelper Set pGPToolCommandHelper = New GPToolCommandHelper pGPToolCommandHelper.SetTool pGPTool pGPToolCommandHelper.Invoke Nothing ' Destroy objects Set pToolboxWorkspaceFactory = Nothing Set pToolboxWorkspace = Nothing Set pGPToolBox = Nothing Set pGPTool = Nothing Set pGPToolCommandHelper = Nothing
... View more
05-04-2012
08:28 AM
|
0
|
0
|
4608
|
|
POST
|
Claire, You should always state what version of ArcGIS you are using if you want us to help you as this dictates what can or cannot be done. If you have ArcInfo then have a look at this tool Feature Vertices To Point in the Data Management toolbox. You could then add M and Z fields and populate using a simple calculate script extract the ZM values. Duncan
... View more
05-04-2012
08:20 AM
|
0
|
0
|
939
|
|
POST
|
Abby, Are your datasets in different coordinate systems (projections)? This may account for the difference. I think some tools perform best when the data is NOT in decimal degrees. Duncan
... View more
05-04-2012
08:10 AM
|
0
|
0
|
3476
|
|
POST
|
Michelle, If you've copied your script correctly then you are missing a bracket at the end of your line. arcpy.CalculateField_management ("FA_Urbans","POPSQMI", "!SQMI!/!FID_1!","PYTHON")
... View more
05-04-2012
08:00 AM
|
0
|
0
|
1077
|
|
POST
|
I think you need to add at the top of your code a simple dim statement like: Dim x Also not sure this line is correct: ElseIf [CLASSIFICATION_1] = "<null>" you may want to try something like (I did not test these): ElseIf [CLASSIFICATION_1] = "" or ElseIf IsNull([CLASSIFICATION_1]) = True Duncan
... View more
05-04-2012
07:41 AM
|
0
|
0
|
6170
|
|
POST
|
Pam, This is just a guess but you mention that the Access database has "numerous forms and reports". This suggests to me that this database is not actually a GeoDatabase? I would image that the zonal stats tool is expecting a GeoDatabase to write to and hence your problems. You should create a GeoDatabase and run the zonal stats tool and send output there to test this? You could then link those tables into your other database? Duncan
... View more
05-02-2012
01:57 AM
|
0
|
0
|
1046
|
|
POST
|
Lorna, FYI I've got ArcGIS 10 and was able to add the DLL to ArcMap without any error and then drag the button onto a toolbar although I did not use it. This would indicate that it's a permission issue for you and you need to get IT "support" to help you. Duncan
... View more
05-02-2012
01:31 AM
|
0
|
0
|
1132
|
|
POST
|
Mike, Your technique is how I create reaches along rivers, so you are not the only guy out there struggling! In the past I've tended to scale the reach by something like strahler order or catchment size. This method will generate overlapping reaches. Your existing 10m long line events will have the route ID and a start/end measure. You could try to start with the line nearest to the source and track downstream and identify when there is a big change in slope and identify that as your reach break? Thus lots of small changes in slow would be aggregated into a single reach. I'm not sure how this will work at tributary junctions at depends how you built your route layer. This will certainly require some coding by you. Duncan
... View more
04-30-2012
08:50 AM
|
0
|
0
|
707
|
| Title | Kudos | Posted |
|---|---|---|
| 3 | Monday | |
| 1 | 02-15-2023 05:45 AM | |
| 1 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 04-15-2026 07:35 AM |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|