POST
|
I have created a set up project to deploy an esri addin. I have used this tutorial ArcObjects 10 .NET SDK Help I am using Arc10.2.1. I use this regkey: SOFTWARE\Wow6432Node\ESRI\Desktop10.2 instead of ' SOFTWARE\ESRI\Desktop10.2' mentioned in the above link. When I try to use the set up.exe i created, I get this error 'ArcGIS Desktop 10.2 is required before you can complete this setup.' while the target machine has ArcGis desktop 10.2 installed. Any help will be appreciated.
... View more
02-24-2016
06:12 AM
|
0
|
1
|
1328
|
POST
|
I have changed the selection symbol of polygons feature layer.I have also added an annotation layer above the polygons layer. but I have found that annotation layer is hidden under the selection symbol though it is added over the polygons feature layer. I have also tried to make the color of the fill symbol of the polygons transparent.but the annotations are hidden under the selection symbol as well. see attached images.
... View more
02-02-2016
01:23 AM
|
0
|
0
|
1918
|
POST
|
I am trying to intersect a geometry with a feature class to get the intersected features with this geometry. but i get this error:" Underlying DBMS error[ORA-29902: error in executing ODCIIndexStart() routine ORA-28578: protocol error during callback from an external procedure ORA-06512: at "SDE.ST_GEOMETRY_SHAPELIB_PKG", line 870 ORA-06512: at "SDE.SPX_UTIL", line 2914 ORA-06512: at "SDE.SPX_UTIL", line 3194 ORA-06512: at "SDE.ST_DOMAIN_METHODS", line 299 " at this line: ESRI.ArcGIS.Geodatabase.IFeature feature = featureCursor.NextFeature(); Here is the code: public static List<ESRI.ArcGIS.Geodatabase.IFeature> PerformSpatialQuery(ESRI.ArcGIS.Geometry.IGeometry geometryToSearchBy, ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum spatialRel, ESRI.ArcGIS.Geodatabase.IFeatureClass featureClassToSearchIn, string subFields) { List<ESRI.ArcGIS.Geodatabase.IFeature> featuresLst = null; try { if (geometryToSearchBy != null && !geometryToSearchBy.IsEmpty && subFields != "" && featureClassToSearchIn != null) { ESRI.ArcGIS.Geodatabase.ISpatialFilter spatialFilter = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass (); spatialFilter.Geometry = geometryToSearchBy; spatialFilter.SpatialRel = spatialRel; spatialFilter.SubFields = subFields; ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = featureClassToSearchIn.Search(spatialFilter, false); featuresLst = new List<ESRI.ArcGIS.Geodatabase.IFeature>(); ESRI.ArcGIS.Geodatabase.IFeature feature = featureCursor.NextFeature(); while (feature != null) { featuresLst.Add(feature); feature = featureCursor.NextFeature(); } } return featuresLst; } catch (Exception ex) { Logger.LoggerInstance.LogError(ex.Message, DateTime.Now, "PerformSpatialQuery", "SpatialOperations", ""); throw new Exception(ex.Message); } }
... View more
07-31-2015
11:26 AM
|
0
|
2
|
3638
|
POST
|
I am trying to union polygons but i get this error "Error HRESULT E_FAIL has been returned from a call to a COM component." at this line :unionedPolygon.ConstructUnion(geometryBag as ESRI.ArcGIS.Geometry.IEnumGeometry); Here is the code : public static ESRI.ArcGIS.Geometry.IPolygon MergePolygonsWithCondition(ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass, String whereClause) { //Check input objects. if (featureClass == null) { return null; } try { ESRI.ArcGIS.Geodatabase.IGeoDataset geoDataset = featureClass as ESRI.ArcGIS.Geodatabase.IGeoDataset; ESRI.ArcGIS.Geodatabase.IQueryFilter queryFilter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass(); queryFilter.WhereClause = whereClause; ESRI.ArcGIS.Geometry.IGeometry geometryBag = new ESRI.ArcGIS.Geometry.GeometryBagClass(); //Define the spatial reference of the bag before adding geometries to it. geometryBag.SpatialReference = geoDataset.SpatialReference; //Use a nonrecycling cursor so each returned geometry is a separate object. ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = featureClass.Search(queryFilter, false); ESRI.ArcGIS.Geometry.IGeometryCollection geometryCollection = geometryBag as ESRI.ArcGIS.Geometry.IGeometryCollection; ESRI.ArcGIS.Geodatabase.IFeature currentFeature = featureCursor.NextFeature(); while (currentFeature != null) { //Add a reference to this feature's geometry to the bag. //Since you don't specify the before or after geometry (missing), //the currentFeature.Shape IGeometry is added to the end of the geometryCollection. object missing = Type.Missing; geometryCollection.AddGeometry(currentFeature.Shape, ref missing, ref missing); currentFeature = featureCursor.NextFeature(); } // Create the polygon that will be the union of the features returned from the search cursor. // The spatial reference of this feature does not need to be set ahead of time. The // ConstructUnion method defines the constructed polygon's spatial reference to be the // same as the input geometry bag. ESRI.ArcGIS.Geometry.ITopologicalOperator unionedPolygon = new ESRI.ArcGIS.Geometry.PolygonClass(); unionedPolygon.ConstructUnion(geometryBag as ESRI.ArcGIS.Geometry.IEnumGeometry); return unionedPolygon as ESRI.ArcGIS.Geometry.IPolygon; } catch (Exception ex) { Logger.LoggerInstance.LogError(ex.Message, DateTime.Now, "MergePolygonsWithCondition", "SpatialOperations", ""); throw new Exception(ex.Message); } }
... View more
07-31-2015
11:21 AM
|
0
|
3
|
3291
|
POST
|
I am trying to get the subtypes of a feature class that has subtypes but i get this error " Unable to cast COM object of type 'System.__ComObject' to interface type 'ESRI.ArcGIS.Geodatabase.ISubtypes'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{AEF78514-848F-11D2- AABA-00C04FA37B82}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)) " at this line :ESRI.ArcGIS.Geodatabase.ISubtypes subtypes = (ESRI.ArcGIS.Geodatabase.ISubtypes)sourceFeatureClass; Here is the code: protected override List<String> GetDistinctGroupFieldValues(MigrationFeatureClassSource source) { if (source.SourceName == "Mekka") { try { List<String> distinctValues = null; ESRI.ArcGIS.Geodatabase.IFeatureClass sourceFeatureClass = source.DataSource.GetFeatureWorkSpaceOfDataSource().OpenFeatureClass(source.SourceTableName); ESRI.ArcGIS.Geodatabase.ISubtypes subtypes = (ESRI.ArcGIS.Geodatabase.ISubtypes)sourceFeatureClass; ESRI.ArcGIS.Geodatabase.IEnumSubtype enumSubtype; int subtypeCode; string subtypeName; if (subtypes.HasSubtype) { distinctValues = new List<String>(); enumSubtype = subtypes.Subtypes; subtypeName = enumSubtype.Next(out subtypeCode); while (subtypeName != null) { subtypeName = enumSubtype.Next(out subtypeCode); if (subtypeName.Contains("???")) { distinctValues.Add(subtypeCode.ToString()); } } } return distinctValues ; } catch (Exception ex) { Logger.LoggerInstance.LogError(ex.Message, DateTime.Now, "GetDistinctGroupFieldValues", "MigrationFeatureClass", m_tableName); throw new Exception(ex.Message); } } else { return base.GetDistinctGroupFieldValues(source); } }
... View more
07-31-2015
11:16 AM
|
0
|
1
|
7096
|
POST
|
I am trying to insert a feature in an empty feature class that was created as a polygon feature class but when i watch the feature class object during debugging i found that it has an esriGeometryAny as a shape type. so i get this error "No support for this geometry type" at this line ESRI.ArcGIS.Geodatabase.IFeatureCursor insertCursor = destinationFeatureClass.Insert(false); Here is the code: protected virtual void MigrateAfterMerge(MigrationFeatureClassSource source) { Stopwatch stopWatch = new Stopwatch(); TimeSpan timeSpan; String elapsedTime; try { stopWatch.Start(); String groupFieldName = GetGrouByFieldName(source); if (groupFieldName != "") { List<String> distinctValues = GetDistinctGroupFieldValues(source); ESRI.ArcGIS.Geodatabase.IFeatureClass sourceFeatureClass = source.DataSource.GetFeatureWorkSpaceOfDataSource().OpenFeatureClass(source.SourceTableName); ESRI.ArcGIS.Geodatabase.IFeatureClass destinationFeatureClass = Globals.GlobalsInstance.StandardDB.GetFeatureWorkSpaceOfDataSource().OpenFeatureClass(m_tableName); String whereClause = ""; ESRI.ArcGIS.Geodatabase.IFeatureCursor insertCursor = destinationFeatureClass.Insert(false); if (distinctValues != null) { foreach (String distinctValue in distinctValues) { if (distinctValue != "") { whereClause += groupFieldName + " = '" + distinctValue + "'"; ESRI.ArcGIS.Geometry.IPolygon unionedFeatures = Spatial_Operations.SpatialOperations.MergePolygonsWithCondition(sourceFeatureClass, whereClause); ESRI.ArcGIS.Geodatabase.IFeatureBuffer destinationFeatureBuffer = CreateRecordInStandardDBFromMergeSource(destinationFeatureClass, source, unionedFeatures, ProcessValue(distinctValue, source)); insertCursor.InsertFeature(destinationFeatureBuffer); } } // Flush the buffer to the geodatabase. insertCursor.Flush(); stopWatch.Stop(); timeSpan = stopWatch.Elapsed; elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds / 10); Logger.LoggerInstance.LogOperationStatus(m_tableName + " - Migerating data from " + source.SourceName + " to standard DB succeeded", SyncOperationStatus.Succeded, m_tableName, DateTime.Now, elapsedTime); } } } catch (Exception ex) { stopWatch.Stop(); timeSpan = stopWatch.Elapsed; elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds / 10); Logger.LoggerInstance.LogOperationStatus(m_tableName + " - Migerating data from " + source.SourceName + " to standard DB failed.", SyncOperationStatus.Failed, m_tableName, DateTime.Now, elapsedTime); Logger.LoggerInstance.LogError(ex.Message, DateTime.Now, "MigrateAfterMerge", "MigrationFeatureClass", m_tableName); throw new Exception(ex.Message); } }
... View more
07-31-2015
11:12 AM
|
0
|
1
|
5171
|
POST
|
I am trying to insert a feature in a feature class but i get this error " Underlying DBMS error[ORA-00001: unique constraint (STATDB.R134_SDE_ROWID_UK) violated ] " at this line insertCursor.InsertFeature(destinationFeatureBuffer); in the code below R134_SDE_ROWID_UK is the index with OBJECT column. Here is the code protected virtual void MigrateAfterMerge(MigrationFeatureClassSource source) { Stopwatch stopWatch = new Stopwatch(); TimeSpan timeSpan; String elapsedTime; try { stopWatch.Start(); String groupFieldName = GetGrouByFieldName(source); if (groupFieldName != "") { List<String> distinctValues = GetDistinctGroupFieldValues(source); ESRI.ArcGIS.Geodatabase.IFeatureClass sourceFeatureClass = source.DataSource.GetFeatureWorkSpaceOfDataSource().OpenFeatureClass(source.SourceTableName); ESRI.ArcGIS.Geodatabase.IFeatureClass destinationFeatureClass = Globals.GlobalsInstance.StandardDB.GetFeatureWorkSpaceOfDataSource().OpenFeatureClass(m_tableName); String whereClause = ""; ESRI.ArcGIS.Geodatabase.IFeatureCursor insertCursor = destinationFeatureClass.Insert(false); if (distinctValues != null) { foreach (String distinctValue in distinctValues) { if (distinctValue != "") { whereClause += groupFieldName + " = '" + distinctValue + "'"; ESRI.ArcGIS.Geometry.IPolygon unionedFeatures = Spatial_Operations.SpatialOperations.MergePolygonsWithCondition(sourceFeatureClass, whereClause); ESRI.ArcGIS.Geodatabase.IFeatureBuffer destinationFeatureBuffer = CreateRecordInStandardDBFromMergeSource(destinationFeatureClass, source, unionedFeatures, ProcessValue(distinctValue, source)); insertCursor.InsertFeature(destinationFeatureBuffer); } } // Flush the buffer to the geodatabase. insertCursor.Flush(); stopWatch.Stop(); timeSpan = stopWatch.Elapsed; elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds / 10); Logger.LoggerInstance.LogOperationStatus(m_tableName + " - Migerating data from " + source.SourceName + " to standard DB succeeded", SyncOperationStatus.Succeded, m_tableName, DateTime.Now, elapsedTime); } } } catch (Exception ex) { stopWatch.Stop(); timeSpan = stopWatch.Elapsed; elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds / 10); Logger.LoggerInstance.LogOperationStatus(m_tableName + " - Migerating data from " + source.SourceName + " to standard DB failed.", SyncOperationStatus.Failed, m_tableName, DateTime.Now, elapsedTime); Logger.LoggerInstance.LogError(ex.Message, DateTime.Now, "MigrateAfterMerge", "MigrationFeatureClass", m_tableName); throw new Exception(ex.Message); } }
... View more
07-31-2015
11:03 AM
|
0
|
1
|
2785
|
POST
|
I am trying to delete features from a feature class but i always get this error "Error HRESULT E_FAIL has been returned from a call to a COM component." at this line feature.Delete(); Here is my code: private void DeleteRecordsFromStandardDBFeatureClass() { try { ESRI.ArcGIS.Geodatabase.IFeatureClass destinationFeatureClass = Globals.GlobalsInstance.StandardDB.GetFeatureWorkSpaceOfDataSource().OpenFeatureClass(m_tableName); ESRI.ArcGIS.Geodatabase.IFeatureCursor searchCursor = destinationFeatureClass.Search(null, false); // Delete the retrieved features. ESRI.ArcGIS.Geodatabase.IFeature feature = null; while ((feature = searchCursor.NextFeature()) != null) { feature.Delete(); } } catch (Exception ex) { Logger.LoggerInstance.LogError(ex.Message, DateTime.Now, "DeleteRecordsFromStandardDBFeatureClass", "MigrationFeatureClass", m_tableName); throw new Exception(ex.Message); } }
... View more
07-31-2015
09:48 AM
|
0
|
1
|
2691
|
POST
|
I have a requirement to set the layout view scale as data view in order to be able to print the same layer shown at the data view scale so i tried the following code to set the layout view scale Public Shared Sub SetLayoutViewScale(ByVal newScale As Double) Dim pActiveView As ESRI.ArcGIS.Carto.IActiveView Dim pMap As ESRI.ArcGIS.Carto.IMap Dim dblDiff As Double Dim dblMapScale As Double Try pActiveView = CType(My.ArcMap.Document.PageLayout, ESRI.ArcGIS.Carto.IActiveView) pMap = pActiveView.FocusMap pMap.MapScale = newScale ' The problem is in this line pActiveView.Refresh() Catch ex As Exception MsgBox("Can't set layout scale") End Try End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' but the problem occurs in this line pMap.MapScale = newScale The MapScale property does not accept the value of newScale and may take different scale. I have found this issue as a bug in Arc9 but i am currently using 10.1 http://support.esri.com/en/knowledgebase/techarticles/detail/27773 I have tried to setup arc10.1 sp1 for arcdesktop and ard10.1 sp1 for .net framework sdk But the same error still occurs. I have also tried to use the following code Public Shared Sub SetMapExtentFromScale(ByVal newScale As Double) 'Get coordinates of current map extent Dim pExtent As ESRI.ArcGIS.Geometry.IEnvelope Dim dblXMin As Double, dblXMax As Double, dblYMin As Double, dblYMax As Double Dim pActiveView As ESRI.ArcGIS.Carto.IActiveView Dim pCenterPoint As ESRI.ArcGIS.Geometry.IPoint Dim pCenterScale As ESRI.ArcGIS.Carto.ICenterAndScale Try pActiveView = CType(My.ArcMap.Document.PageLayout, ESRI.ArcGIS.Carto.IActiveView) pExtent = pActiveView.Extent dblXMin = pExtent.XMin dblXMax = pExtent.XMax dblYMin = pExtent.YMin dblYMax = pExtent.YMax 'Calculate center point of current map extent pCenterPoint = New ESRI.ArcGIS.Geometry.Point pCenterPoint.SpatialReference = pActiveView.FocusMap.SpatialReference pCenterPoint.X = dblXMin + (dblXMax - dblXMin) / 2 pCenterPoint.Y = dblYMin + (dblYMax - dblYMin) / 2 'Assign center point and map scale to new CenterAndScale object pCenterScale = New ESRI.ArcGIS.Carto.CenterAndScale pCenterScale.Center = pCenterPoint pCenterScale.MapScale = newScale 'Assign new CenterAndScale object to MapDescription pActiveView.Extent = CType(pCenterScale, ESRI.ArcGIS.Carto.IMapArea).Extent pActiveView.Refresh() Catch ex As Exception MsgBox("Can't set layout scale") End Try End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' but CType(pCenterScale, ESRI.ArcGIS.Carto.IMapArea).Extent throws an exception So any help to set the layout scale or workaround would be appreciated. Thanks
... View more
12-10-2013
09:43 PM
|
0
|
0
|
579
|
POST
|
Has anyone faced this syntax error before ? Implementing class 'ESRI.ArcGIS.Carto.RasterLayerClass' for interface 'ESRI.ArcGIS.Carto.RasterLayer' cannot be found. in second line below Dim pRasterLayer As ESRI.ArcGIS.Carto.IRasterLayer pRasterLayer = New ESRI.ArcGIS.Carto.RasterLayer I've already added the ESRI.ArcGIS.Carto reference to my solution
... View more
05-23-2010
03:36 AM
|
0
|
2
|
489
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|