POST
|
I am instantiating a Geodatabase using the ServiceConnectionProperties constructor, which contains the url of a map service. If I call GetDefinitions() (for either TableDefinition or FeatureClassDefinition), the method returns an empty list. However, I am able to access specific tables and their definitions using OpenDataset() and GetDefinition(). Through tinkering in Visual Studio's immediate window, I have found that if I call OpenDataset() on a specific table, then THAT table's definition will appear in the results of GetDefinitions(). For example, I have a map service with 19 feature classes. If I call OpenDataset() on 8 of those feature classes, then those 8 - and only those 8 - will appear in the results of GetDefinitions(). I was hoping to use the workflow described in other threads related to fetching data from map services: I have a string that likely matches an alias of one of the map service's feature classes or tables. I call GetDefinitions() to get all of the table definitions, and then call GetAlias() for each of those definitions, so that I can match the alias. This is still technically possible with a workaround (call GetDefinition("0"), GetDefinition("1"), etc. until I either find a match or until that causes an Exception), but it'd be nice to actually get all of the definitions off the bat. Is this a bug? Something potentially wrong with the way the Map Service is set up? I would assume the latter isn't the case, as I've been testing using the ESRI World_Imagery service. Edit - here is the Map Service I'm using to test: https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer
... View more
01-27-2021
08:54 AM
|
0
|
2
|
889
|
POST
|
I figured this out. If anyone else is having a similar problem, my issue was that I was taking the "INSTANCE" key-value pair out of the workspace connection string and assigning it to the Instance property of the DatabaseConnectionProperties object used to instantiate the Database. The value in this case was something along the lines of sde:sqlserver:server\instance This didn't cause any problems for Oracle connections (sde:oracle:instance), but for SQL Server it was apparently not even connecting to an existing instance. I instead used the DB_CONNECTION_PROPERTIES value from the workspace connection string - but still assigned that value to the Instance property of the DatabaseConnectionProperties object. The only difference in the values is that the DB_CONNECTION_PROPERTIES value is simply server\instance (no sde:sqlserver qualifier).
... View more
01-07-2021
11:53 AM
|
0
|
0
|
885
|
POST
|
I'm trying to read in the connection properties from the DataConnection property of a CIMFeatureLayer's FeatureTable property, and use those properties to instantiate an ArcGIS.Core.Data.Database object (using the constructor that takes a DatabaseConnectionProperties object). This is a SQLServer connection that was created in the Catalog, and whose layer(s) were added to the Map represented in a CIMMapDocument. I have done this successfully with an Oracle connection, but I'm having trouble getting it to work with a SQLServer connection. I am just parsing the WorkspaceConnectionString from the CIMStandardDataConnection and using those key-value pairs (AuthenticationMode, Branch, Database, Instance, etc.) to create a DatabaseConnectionProperties object. The issue with a SQLServer connection happens when I try to instantiate a Database object using those properties. The constructor call causes the database configuration dialog to pop up in the the Arc Pro GUI - which is expected, given that the password is not saved unencrypted in the CIM, and it will need to be provided. However, when I enter the password, I get an indefinite hang. If I turn on the most granular exception-handling in my debugger, I get the COM exception: 'Exception from HRESULT: 0x80050199'. Following that exception is the GeodatabaseEnterpriseException, : 'Lost connection to underlying DBMS. Reason: Failure to access the DBMS server'. I'm not sure how to proceed. There could be something wrong in the way I'm creating the DatabaseConnectionProperties, but the fact that the same method is working for an Oracle connection makes me wonder if the problem lies elsewhere.
... View more
01-07-2021
06:11 AM
|
1
|
1
|
912
|
POST
|
I'm doing some layout modifications and rendering using the CIM. The process starts with the importation of an existing layout (the "template") by reading a pagx file into a JSON string. We then call CIMLayoutDocument.FromJson() to get an in-memory representation of the entire Layout and its components. This has been working as expected until I added a Feature Service layer (a Polyline layer) to a Map referenced by the Layout in question. Since this Map is referenced by the Layout, it gets included in the list of CIMMaps in the CIMLayoutDocument. With that feature service layer added, the call to CIMLayoutDocument.FromJson() produces an error, "Value was either too large or too small for an Int32." All the stack trace shows is that this is the result of a call to System.Convert.ToInt32(). Is this a bug?
... View more
01-04-2021
05:56 PM
|
0
|
1
|
530
|
POST
|
@KirkKuykendall1 thanks so much for the help. Do you know what you'd do in the case of a FeatureLayer based on a Shapefile?
... View more
12-31-2020
11:53 AM
|
0
|
0
|
1065
|
POST
|
My team is working on removing Desktop namespace references throughout our code in order to create a standalone application that doesn't rely on the Arc Pro GUI. One of the things we need to do is get data from map layers. We can pull in the CIMMap and associated CIMFeatureLayers from a CIMLayoutDocument that describes the layout we want to render. Since we're not using the Desktop namespace, however (and since our starting point is a CIMLayoutDocument, not a Map), we can't use the FeatureLayer class's search functions. I know Core.Data contains the Database class (along with Geodatabase and other children of Datastore). These classes seem to offer some of the functionality that we need, but we also have a home-grown class that reads through a Geodatabase given a path - either .gdb or .sde. For a layer added via a geodatabase, this makes things simple - just get the gdb path from the CIMFeatureLayer's FeatureTable's DataConnection, and use it to instantiate said home-grown class. However, I'm wondering what to do when features from a SQL or Oracle database have been added to the map. Creating that connection in the Arc Pro Catalog automatically creates an SDE file, but when I look at the corresponding CIMFeatureLayer object in the corresponding CIMLayoutDocument, I don't see a direct reference to that .sde. Instead I see the WorkspaceConnectionString, which contains what appear to be all the necessary connection properties to instantiate a Core.Data Database object. Let's say I just wanted to grab the .sde path associated with the enterprise database used to add that feature layer to the map....Would I need to create a Database object with the constructor that calls for a DatabaseConnectionProperties object? If so, is there a built-in way to parse the WorkspaceConnectionString into a set of DB connection properties? It seems rather roundabout, but what I would be doing is: -parse the WorkspaceConnectionString for the Oracle / SQL (SDE) connection into its constituent properties -create a DatabaseConnectionProperties object using those parsed properties -Instantiate a Database object using that DatabaseConnectionProperties object -Call GetPath() on the newly instantiated Database, which hopefully would give me some path to the .sde I need. Is there a simpler way to do this?
... View more
12-30-2020
01:45 PM
|
1
|
3
|
1099
|
POST
|
The application I'm working on needs to be export layouts to PDF and other formats. My team first did this using the ArcGIS Pro .NET SDK Layout class's export methods. In order to eliminate references to Desktop namespaces, we're now exporting via ArcPy by importing a layout from pagx and calling ExportToPDF and other format-specific methods. All of our elements are in place, but all of the colors are slightly different from the .NET SDK to ArcPy. Is this a known issue? Are there certain defaults that are different between platforms?
... View more
12-21-2020
06:29 AM
|
0
|
0
|
292
|
POST
|
When instantiating an ArcGIS Pro dockpane, the base class's virtual InitializeAsync() method makes it possible to use asynchronous methods in the pane's instantiation. There are several places in our code where we override this method in our dockpane view models (and call asynchronous methods), and they works just as expected. I'm dealing with a case where I need to do the same thing with a Arc Pro button, but the Button class and its parent classes don't include an InitializeAsync() method. Is there a roughly equivalent solution?
... View more
10-12-2020
01:52 PM
|
0
|
0
|
464
|
POST
|
Thank you Wolfgang Kaiser. For others interested, this is the code I used to grab the path from the registry key Wolfgang provided: RegistryKey arcGISProInstallDirectoryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\ESRI\ArcGISPro");
object pythonDirectoryKeyValue = arcGISProInstallDirectoryKey.GetValue("PythonCondaRoot");
string pythonDirectoryPath = pythonDirectoryKeyValue.ToString();
string localExecutablePath = @"Scripts\propy.bat";
string pythonExeutablePath = Path.Combine(pythonDirectoryPath, localExecutablePath);
... View more
10-08-2020
07:49 AM
|
2
|
0
|
1210
|
POST
|
I'm creating a CoreHost app that needs to be able to call ArcPy scripts. To do this, we need (from what I understand) to know the local machine's python path - specifically the path of the python .exe installed with Arc Pro. I've accomplished this on my development machine by just hardcoding the path to the ArcGIS directory in Program Files - but how can we get the appropriate executable without knowing where and how the user has installed Arc Pro?
... View more
10-07-2020
01:25 PM
|
0
|
3
|
1256
|
POST
|
I know it's possible to modify a layout from a pagx file using Core (CIMLayoutDocument.FromJson seems to work fine for getting at the CIMLayoutDocument and CIMLayout). However, I'm not sure whether it's possible to export to PDF using a core application. The Layout.Export() method does this in the Desktop environment. Is there an analog to that method in the Core environment?
... View more
10-06-2020
12:23 PM
|
0
|
1
|
460
|
POST
|
I'm trying to programatically create a few types of charts within a Layout - point charts, line charts, and bar charts. Line charts and bar charts are both going to be sets of polylines, and given that Polyline objects can be combined to make one big Polyline, these chart types require only one call to LayoutElementFactory.Instance.CreateLinegraphicElement (we can just pass the combined Polyline). I'm not seeing a similar method that takes a Multipoint. So, in the case of a point chart, we're having to call CreatePointGraphicElement for every single point on the chart, passing each Coordinate2D at a time. Are there plans to add a method to LayoutElementFactory that takes a MultiPoint, a list of MapPoints, or a list of Coord2D? Either an overload of CreatePointGraphicElement or a new method called something like CreateMultiPointGraphicElement? If not, is there a workaround that would allow for the creation of a multiple point GraphicElement with only one call to a LayoutElementFactory creation method? Element creation incurs a lot of overhead, and thus far we've been able to make big improvements in performance by condensing those calls.
... View more
07-01-2020
12:23 PM
|
1
|
0
|
381
|
POST
|
I'm not sure that would be a better solution, but it could be a solution. Our application is centered on creating fairly elaborate layouts, which customers will generally print or view as PDFs. It would be preferable to leave Maps "as is" and create Layout elements whose positions are synced with Map Points within a Map Frame. However, the solution you're talking about may work for essentially the same purpose. I'm not sure I understand how map graphics are different from existing functionality, however. Are we talking about text and shapes completely distinct from the features stored in feature classes? Would these graphics simply be stored in the Project file, and not within some other database (e.g. a geodatabase)?
... View more
06-09-2020
11:56 AM
|
0
|
1
|
683
|
POST
|
Thanks Jeff Barrette. If you don't mind, I'd like to draw your attention to a related question I posted yesterday: https://community.esri.com/thread/254673-what-does-a-map-frame-cameras-scale-mean-in-the-context-of-angular-units Also, as for the above example - this assumes a specific combination of linear units, and that the map frame's camera's heading is 0 (no rotation). I've accounted for rotation successfully, but per the question referenced above, I'm not sure how to account for angular units. How can we something like translate between inches on a page and decimal degrees within a map frame, for instance?
... View more
06-09-2020
11:39 AM
|
0
|
0
|
616
|
POST
|
Our Add-In requires that we translate coordinates on a Map to coordinates on a Layout that contains a given MapFrame. Per a previous discussion, this has to be done manually, at least for now - unless there is some way I'm unaware of to easily ask the SDK, "Where is this MapPoint represented on the page within this given map frame?" That in mind, I'm using the map frame camera's Scale property, along with the camera's spatial reference's unit and the page's unit, to determine a number that represents the "page units per map unit." The linked post includes an example that assumes map units in feet and page units in inches, but this assumption won't necessarily hold true. I use the "page units per map unit" figure to relate real-world map distances to distances on the page. I'm not sure how to apply this scheme (if it can be applied) to situations where the map frame's map and camera have angular units. What does the camera's Scale property really mean when the camera's units are angular? API documentation describes the Scale property as "a ratio of distance on the map to reality." Is there some way in which, for instance, decimal degrees are being "converted" to meters?
... View more
06-08-2020
10:43 AM
|
0
|
4
|
742
|
Title | Kudos | Posted |
---|---|---|
1 | 01-07-2021 06:11 AM | |
1 | 07-01-2020 12:23 PM | |
1 | 12-30-2020 01:45 PM | |
2 | 10-08-2020 07:49 AM |