|
POST
|
Joseph, I've never had any problems with the ConstructUnion method. So after reading your thread I knocked together the following VBA code to test it. I was able to run it without error on 40K and 60K polygons. This suggests to me that it may be an issue with your input data? Have you run it through the check geometry tool first to see if there are any offending polygons?
Public Sub Test()
' Get layer
Dim pMXDocument As IMxDocument
Set pMXDocument = ThisDocument
Dim pMap As IMap
Set pMap = pMXDocument.FocusMap
Dim pLayer As ILayer
Set pLayer = pMap.Layer(0)
Dim pFeatureLayer As IFeatureLayer
Set pFeatureLayer = pLayer
' Get the 40,000 selected polygons
Dim pFeatureSelection As IFeatureSelection
Set pFeatureSelection = pFeatureLayer
Dim pSelectionSet As ISelectionSet
Set pSelectionSet = pFeatureSelection.SelectionSet
Debug.Print pSelectionSet.Count
' Create cursor over selection
Dim pCursor As ICursor
pSelectionSet.Search Nothing, False, pCursor
Dim pRow As IRow
Set pRow = pCursor.NextRow
Dim pPolygon As IPolygon
Dim pGeometryBag As IGeometryBag
Set pGeometryBag = New GeometryBag
Dim pSpatialReference As ISpatialReference
Dim pGeoDataset As IGeoDataset
Set pGeoDataset = pFeatureLayer.FeatureClass
Set pSpatialReference = pGeoDataset.SpatialReference
Set pGeometryBag.SpatialReference = pSpatialReference
Dim pGeometryCollection As IGeometryCollection
Set pGeometryCollection = pGeometryBag
' Add polygons to bag
Debug.Print "Adding to geometry bag"
Do While Not pRow Is Nothing
Set pPolygon = pRow.Value(pRow.Fields.FindField("Shape"))
pGeometryCollection.AddGeometry pPolygon
Set pRow = pCursor.NextRow
Loop
Debug.Print "done looping"
' Do the union
Dim pTopoOp As ITopologicalOperator
Set pTopoOp = New Polygon
Dim pEnumGeometry As IEnumGeometry
Set pEnumGeometry = pGeometryBag
Debug.Print CStr(pEnumGeometry.Count) & " in bag"
pEnumGeometry.Reset
pTopoOp.ConstructUnion pEnumGeometry
Debug.Print "Got here with out error!"
End Sub
I'm using ArcGIS 10.1, Windows 7, 4GB Ram. Duncan
... View more
06-12-2013
07:46 AM
|
0
|
0
|
851
|
|
POST
|
Tim, Without actually seeing a sample of the error message I'm just thinking out aloud here. Have you tried setting the target CPU to x86 under the Project properties > compile > advanced compiler settings? At what point do the errors occur, before the console program starts or some random point during it? It sounds like something is being installed on your machine which is not being packaged up by your installer or is simply missing from your clients machines? Is it some horrible citrix setup and the libraries are not being installed on the clients machine? Have you checked everything is actually being packaged up by the installer? Duncan
... View more
06-12-2013
06:30 AM
|
0
|
0
|
866
|
|
POST
|
Zach, As Terry indicated you want to be driving ArcMap using Automation, a similar question recently popped up on this forum thread. Try searching for the topic Automation on this forum and keywords like AppROT and IObjectFactory. Duncan
... View more
06-11-2013
07:59 AM
|
0
|
0
|
872
|
|
POST
|
Scott, Looking at your code I noticed you commented out an Access 2007 (accdb) database. Has your data migrated into this format? If it has or it will then its worth reading this page. Duncan
... View more
06-11-2013
07:40 AM
|
0
|
0
|
1094
|
|
POST
|
Just thinking out aloud here, you are getting your point from the display, but this may be a different projection to the layer you are attempting to to digitize into?
... View more
06-10-2013
01:54 PM
|
0
|
0
|
580
|
|
POST
|
Thomas, Are you using 10.1? Are these lines horizontal or vertical? If so it may be related to this bug introduced by ESRI in 10.1. Duncan p.s. You should always state your version of ArcGIS as it helps us help you.
... View more
06-10-2013
01:37 PM
|
0
|
0
|
1712
|