|
POST
|
Demetris, See sample VBA code below on how to get a descending sort order. Duncan Public Sub Test()
Dim pTable As ITable
Set pTable = FindTableInMap("Downstream_Polylines")
Dim pTableSort As ITableSort
Set pTableSort = New esriGeoDatabase.TableSort
With pTableSort
Set .Table = pTable
Set .QueryFilter = Nothing
.Fields = "OBJECTID"
.Ascending("OBJECTID") = True ' TRUE is ascending, if set to FALSE then descending
.Sort Nothing
End With
Dim pCursor As ICursor
Set pCursor = pTableSort.Rows
Dim pRow As IRow
Set pRow = pCursor.NextRow
Do While Not pRow Is Nothing
Debug.Print pRow.Value(0)
Set pRow = pCursor.NextRow
Loop
End Sub
... View more
01-14-2011
02:21 AM
|
0
|
0
|
573
|
|
POST
|
Brent, OK, first thing first, if you run your model from ArcMap and supply those parameters exactly how you've written them does the model execute without a problem? I ask this as you have brackets a spaces in your path names. If you are not getting an error running it as a model then it suggests something is going wrong with the parameters. Also the execute method returns an object of type IGeoProcessorResult. Maybe you should get a hold of that and see what kind of error message it's returning? Have you set you parameters object to IVariantArray? Duncan
... View more
01-13-2011
10:27 AM
|
0
|
0
|
752
|
|
POST
|
bxe6736, Is this your real name? The only thing I spotted with your code snippet is the line: Dim GP As Geoprocessor = New Geoprocessor() I think should be: Dim GP As IGeoprocessor = New Geoprocessor() If this does not fix your problem it would help us if you uploaded the toolbox, does the model have parameters for example as you are supplying none? Duncan
... View more
01-12-2011
08:15 AM
|
0
|
0
|
752
|
|
POST
|
Dale, If I was calling an existing geoprocessing tool in VB then I would use the IGeoProcessor Interface. Search for this in the Help and then may be the forum to see how to set it up and supply the parameters to execute it. Have a look at this thread, the basic syntax is all there. Duncan
... View more
01-09-2011
04:05 AM
|
0
|
0
|
589
|
|
POST
|
Chris, First of all do you have the VBA developer help installed? If you are going to do any coding in VBA this is essential as you can search this or highlight an ArcObjects interface in the VBA editor and press F1 to find out all about it. You'll need the installation DVD to install it. Once you got that going just type IEditor you will see a method called StartEditing and all the others you need. Most Interfaces come with example code and you can see exactly how to start and stop editing in VBA. Duncan
... View more
01-09-2011
03:46 AM
|
0
|
0
|
438
|
|
POST
|
Neil, IHitTest... never knew about this Interface, ArcObjects just keeps on giving! 🙂 Duncan
... View more
12-16-2010
01:34 AM
|
0
|
0
|
553
|
|
POST
|
Orsela, The way I would have done this is use the ISegmentCollection and it's property Segment to loop over the collection of ISegments then use something like IProximityOperator to test if the point intersects the segment. Well that's how I would have done it... Duncan
... View more
12-15-2010
04:48 AM
|
0
|
0
|
553
|
|
POST
|
Harsha, What format is your underlying data stored as? If you've got MM then that should be stuck in a File Geodatabase and compressed. If any of your data is Shapefile make sure you have built spatial indices for them. If your data is multi-part explode it into single part and make sure you have a scale threshold set for layers. If you are opening the MXD at the level of the UK you only want to be displaying the coastline and probably key cities, motorways then the other datasets become visible at their appropriate scale. Duncan
... View more
12-15-2010
04:41 AM
|
0
|
0
|
664
|
|
POST
|
Kalid, This can be achieved by using the "field_CumulateValues.cal" script which is free to download from this website. In fact there are many useful scripts here. Duncan
... View more
12-11-2010
03:04 PM
|
0
|
0
|
588
|
|
POST
|
Joe, Finally! I'm always telling people to RTFM and I practise what I preach but it seems the 9.3 desktop help is not the same as the 9.3 online desktop help. I note it says on that page (despite it saying 9.3 Help) that it has been update for 9.3.1 and there bold as brass is that property Path... There are a load of other properties too I never knew the describe object could do, this is very frustrating. The sooner they give up on python and go back to VBA the better! 😉 Thanks for your help. Duncan
... View more
12-09-2010
01:37 PM
|
0
|
0
|
1626
|
|
POST
|
Joe, Sorry to bang on about this but I looked at the Help page you identified, a page I have looked at before but I see NO mention of the property (thanks for correcting me) Path. There is the property CatalogPath which you use on a dataset object but this actually returns something slightly different (with a shapefile). So where did you find out about the property Path? Duncan
... View more
12-09-2010
12:14 PM
|
0
|
0
|
1626
|
|
POST
|
Hi, Thats a good way of determining the workspace, but my question is where is the method Path documented in the Desktop help file? I find no mention of this method in the help file or object model! I get your point about placing this question in the other thread but I've always considered that to be about processing not annoying specifics of Python! Thanks for your help. Duncan
... View more
12-08-2010
11:36 PM
|
0
|
0
|
1626
|
|
POST
|
Python Gurus, As you all know there is the annoying problem of SQL syntax between different storage formats, by this I mean for a Personal Geodatabase a field is enclosed in [] whilst a file geodatabase has fields enclosed in "". I've recently became aware of a useful method of the geoprocessor AddFieldDelimiters that automates the correct enclosure based upon a workspace requirements. The Object Model diagram shows that the syntax is gp.AddfieldDelimiters(fieldname,workspace). Now I often expose my scripts as tools within ArcToolbox so my input parameters are usually a FeatureLayer. My problem is that having looked at the Object Model I can't work out how one gets a handle on the Workspace of a FeatureLayer which I could then use to feed into the AddfieldDelimiters method for building the correct SQL syntax. I thought the Describe method would help with this but it seems it is not possible. What I want to avoid is the user having to select not only the FeatureLayer but then navigate to it's Workspace in the ArcToolbox interface. So my question is simply how does one get the workspace of a featurelayer using the geoprocessor in Python? I am using ArcGIS 9.3. Duncan
... View more
12-08-2010
01:46 AM
|
0
|
7
|
5220
|
|
POST
|
Rory, Take a look at the desktop help file! It has hundreds of examples of how to script the geoprocessing tools in Python. Depending upon exactly what you want to do you may want to merge tables or append data to an existing table? Anyway search the help file for the Merge tool and at the bottom of the page there is always a short example of the tool being called using Python under the section Scripting syntax. Duncan
... View more
12-08-2010
01:24 AM
|
0
|
0
|
929
|
|
POST
|
Greg, Here is the VBA code for loading a table into the map document: Sub test2()
' Get document
Dim pMXDocument As IMxDocument
Set pMXDocument = ThisDocument
' Get Map
Dim pMap As IMap
Set pMap = pMXDocument.FocusMap
' Get table collection
Dim pStandaloneTableCollection As IStandaloneTableCollection
Set pStandaloneTableCollection = pMap
' Create workspacefactory (for opening up dBase files)
Dim pWorkspaceFactory As IWorkspaceFactory
Set pWorkspaceFactory = New ShapefileWorkspaceFactory
Dim pFeatureWorkSpace As IFeatureWorkspace
Set pFeatureWorkSpace = pWorkspaceFactory.OpenFromFile("C:\Temp", 0)
' Get dBase table
Dim pTable As ITable
Set pTable = pFeatureWorkSpace.OpenTable("testtable") ' note no .dbf
' Create StandaloneTable
Dim pStandaloneTable As IStandaloneTable
Set pStandaloneTable = New StandaloneTable
Set pStandaloneTable.Table = pTable
pStandaloneTable.Name = "My Table"
' Add table to Map
pStandaloneTableCollection.AddStandaloneTable pStandaloneTable
pMXDocument.UpdateContents
End Sub Duncan
... View more
11-30-2010
04:46 AM
|
0
|
0
|
1232
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 4 weeks ago | |
| 1 | 11-21-2025 06:54 AM |
| Online Status |
Offline
|
| Date Last Visited |
Wednesday
|