POST
|
I developed an Addin in AGP 2.5 where I am using connection files to open database connections at runtime. So far that worked perfect. The connection files are stored on a network drive, referenced in the Addin with absolute paths. DatabaseConnectionFile connectionFileValidering = new DatabaseConnectionFile(new Uri(AppSettings.Default.sde_validation)); Now that I am doing some maintenance on the Addin I am running into the following error when trying to open the enterprise database: Database test_db = new Database(connectionFileValidation); 'Database test_db = new Database(connectionFileValidation)' threw an exception of type 'ArcGIS.Core.Data.GeodatabaseException' Data: {System.Collections.ListDictionaryInternal} HResult: -2146233088 HelpLink: null InnerException: {"Error HRESULT E_FAIL has been returned from a call to a COM component."} Message: "A geodatabase exception has occurred." Source: "ArcGIS.Core" StackTrace: " at ArcGIS.Core.Data.Database..ctor(DatabaseConnectionFile databaseConnectionFile)" TargetSite: {Void .ctor(ArcGIS.Core.Data.DatabaseConnectionFile)} With respect to the error message I found some stuff that is not related to ArcGIS, but did not help either. Anybody here can point me the direction of a solution?
... View more
11-13-2020
02:42 AM
|
0
|
1
|
92
|
POST
|
Thanks a lot Wolfgang Kaiser! Your lines did it. Adjusting the value assignment to WorkspaceConnectionString = $"DATABASE={newGDB}" was already enough, but I will stick to line 9 and 10 of your example as well. Best regards Thomas
... View more
09-22-2020
01:01 AM
|
0
|
0
|
149
|
POST
|
Hi Uma, any status change on the issue described above? Bests Tom
... View more
09-21-2020
06:33 AM
|
0
|
1
|
86
|
POST
|
Hi Rich, do you think it's possible your colleagues who work on the Map API could have a look at it? Bests Tom
... View more
09-21-2020
06:31 AM
|
0
|
0
|
149
|
POST
|
Thank you Rich! Looking forward to the suggestions of your colleagues, and I am pretty sure, the Map.Redraw is needed in the whole process. Thomas
... View more
09-16-2020
11:31 PM
|
0
|
0
|
149
|
POST
|
Hmm, since the Map.Redraw(true) does not solve the issue, do you or one of you colleagues have a suggestion on how to get the data source shift working?
... View more
09-16-2020
08:46 AM
|
0
|
3
|
149
|
POST
|
Hi Rich, I did not call Map.Redraw, but I have now... Since Map.Redraw is called on the MapView object I had to switch from the Map object to MapView. Hence, selectedMapAjour is now of type MapView. The code look now as follows: if ( selectedMapAjour != null && ! string . IsNullOrEmpty ( PathGdbAjour ) ) { foreach ( FeatureLayer layer in selectedMapAjour . Map . Layers . OfType < FeatureLayer > ( ) ) { GetSetDataConnection ( selectedMapAjour , layer , PathGdbAjour ) ; } } private async void GetSetDataConnection ( MapView mapview , FeatureLayer layer , string newGDB ) { await QueuedTask . Run ( ( ) = > { CIMFeatureLayer def = layer . GetDefinition ( ) as CIMFeatureLayer ; var dcon = def . FeatureTable . DataConnection as CIMStandardDataConnection ; dcon . WorkspaceConnectionString = System . IO . Path . Combine ( newGDB , layer . Name ) ; dcon . Dataset = layer . Name ; layer . SetDefinition ( def ) ; mapview . Redraw ( true ) ; } ) ; } Line 18 does not change the result. When I adjust the data source for a layer manually, then I have to select the appropriate feature class within the geodatabase. Confirming the 'Change Data Source' dialogue makes the layer properties dialogue flash and thereafter the property for the database contains the path to the database. All other information of the layers data source properties are populated. The property 'Feature Class' does not only have the name of the feature class but also a button, holding information about the 'Object Class ID'. When I run my code, the property for the database in the layer property dialogue is showing the entire path, down to the feature class C:\Projects\Support\geo_507474_20200721_12_42.gdb\Bassin. The property for Feature Class in the dialogue show the name of the feature class (without the button for the 'Object Class ID'), while all other properties only show a 'Not Available'. Putting the redraw into the GetSetDataConnection method means that for every layer the map view will be redrawn. I set the redraw in there because when having it right after line 6 I am told that the redraw method must be called on the thread this object was created. Do I have to set the redraw into the GetSetDataConnection method or can I do this also at a more 'central place' where the map view is only updated once all layers got their new data source.
... View more
09-16-2020
01:43 AM
|
0
|
5
|
149
|
POST
|
If the id you provided would be a DockPane (ref to "activate a TOC View") then you would do the following: DockPane pane = FrameworkApplication . DockPaneManager . Find ( "esri_mapping_SnappingView" ) ; if ( pane == null ) return ; pane . Activate ( ) ; I am not aware of any dockpane for snapping. Doesn't mean it's not there...
... View more
09-15-2020
07:41 AM
|
0
|
0
|
24
|
POST
|
I have a couple of map panes in ArcGIS Pro where the data source might differ from one occasion to te other. However, the name of the FeatureLayers are constant. I am trying to adjust the underlaying data source based on user input. Meaning, the user has an OpenItemDialog listening on geodatabases. Plan is to use the retrieved path for the update. However, I don't succeed. In the following code snippet the selectedMapAjour is of type Map if ( selectedMapAjour != null && ! string . IsNullOrEmpty ( PathGdbAjour ) ) { foreach ( FeatureLayer layer in selectedMapAjour . Layers . OfType < FeatureLayer > ( ) ) { GetSetDataConnection ( layer , PathGdbAjour ) ; } } private async void GetSetDataConnection ( FeatureLayer layer , string newGDB ) { await QueuedTask . Run ( ( ) = > { CIMFeatureLayer def = layer . GetDefinition ( ) as CIMFeatureLayer ; var dcon = def . FeatureTable . DataConnection as CIMStandardDataConnection ; dcon . WorkspaceConnectionString = System . IO . Path . Combine ( newGDB , layer . Name ) ; layer . SetDefinition ( def ) ; } ) ; } The code runs through... only the exclamation mark in the TOC of the map do not disappear. Although, the path set via dcon.WorkspaceConnectionString is reflected in the properties of the FeatureLayers in the TOC. Hence, I am not sure if my attempt to alter the data source worked and I am missing some refresh or update call, or if this does not work at all. I basically need a C# equivalent of updateConnectionProperties. Thereafter, I will have to adjust the symbology, so ApplySymbologyFromLayer would be next. Does anybody has an example for this stuff? Best Thomas
... View more
09-15-2020
06:34 AM
|
0
|
9
|
243
|
POST
|
Hi Uma, I had to check myself, and simply created a project with two empty map panes. Using the method from the original posting it identifies "Map" correctly, but "Map1" (sitting hidden behind "Map") comes out without a map object. I will try to add the project as a zip file... Bests Thomas
... View more
09-14-2020
09:58 AM
|
0
|
0
|
86
|
Online Status |
Offline
|
Date Last Visited |
11-16-2020
04:48 AM
|