POST
|
Hi, I would like to share Esri answer related to our problems described above: "It seems the issue related to the deadlock. since the below code snippet: protected override void OnClick() {bool ret = QueuedTask.Run(() =>{}).Result;}, as they will be blocking the UI thread. Based on the code snippet: The top-level method synchronously blocks on the Task returned by queueTaskRun. This blocks the context thread. Deadlock occurs. The top-level method is blocking the context thread, waiting for Geodatabase to complete, and bool ret = QueuedTask.Run(() =>{} is waiting for the context to be free so it can complete. Hope below two doc links helpful: c# - async void when overriding - Stack Overflow Don't Block on Async Code (stephencleary.com)" Using QueuedTask.Run without Results works fine.
... View more
11-23-2022
11:11 PM
|
0
|
0
|
147
|
POST
|
I think the mapservice needs to be published with "feature access" enabled. When that is done, there should be a url with FeatureServer in it. The code below works for me with Naperville sample data: private void ListDefs()
{
var url = @"https://sampleserver7.arcgisonline.com/arcgis/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer";
QueuedTask.Run(() =>
{
var scp = new ServiceConnectionProperties(new Uri(url));
var geodb = new Geodatabase(scp);
var defs = geodb.GetDefinitions<FeatureClassDefinition>();
foreach (var def in defs)
Debug.Print($"{def.GetName()} {def.GetAliasName()}");
});
}
... View more
01-27-2021
11:00 AM
|
1
|
0
|
879
|
POST
|
If you create a layout with a map that only contains that feature service layer you still get the error? If so can you attach the json?
... View more
01-07-2021
01:18 PM
|
0
|
0
|
516
|
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
|
915
|
POST
|
Featurelayers based on shapefiles use a CIMStandardDataConnection, whose JSON can be parsed to get the info needed to open via a FileSystemDatastore: public static void OpenShapefile()
{
var folder = @"D:\tests\myfolder";
var shpName = "myshapefile";
var connPath = new FileSystemConnectionPath(
new Uri(folder), FileSystemDatastoreType.Shapefile);
using (var store = new FileSystemDatastore(connPath))
{
using (var fc = store.OpenDataset<FeatureClass>(shpName))
{
Debug.Print($"{fc.GetCount()}");
};
}
}
... View more
01-01-2021
08:54 AM
|
1
|
0
|
1083
|
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
|
303
|
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
|
481
|
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
|
1276
|
POST
|
Similar issues here. My add-in performs custom export of layouts to PDF. I need to do automated testing (and in the future provide Python support), which requires opening a project, retrieving a layout, and passing it to my software for export. See nunit-projectopenasync.
... View more
10-08-2020
09:15 AM
|
0
|
0
|
461
|
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
|
391
|
POST
|
David, here is the response from one of our developers concerning angular units: "The way angular units are converted to linear units for this purpose in Pro is to get the circumference of the datum from the spatial reference. The circumference is determined by the major axis of the datum. This circumference represents 360 degrees or 2pi radians, so the conversion would be circumference/360 (linear units (m) per degree). Note that in ArcMap there was just a hardcoded constant, regardless of which datum was used." I hope this helps, Jeff - Layout Team
... View more
06-09-2020
02:26 PM
|
0
|
0
|
713
|
POST
|
David, in addition to Wolf's suggestion, please see the below event. The ProjectItemsChangedEventArgs will tell you what the change is (map added, removed, layout added, removed, etc,etc) via its Action and ProjectItem properties. ArcGIS.Desktop.Core.Events.ProjectItemsChangedEvent
... View more
07-27-2020
04:49 PM
|
0
|
0
|
410
|
POST
|
I have similar concerns. My add-in performs custom PDF export of layouts. To automate testing, and in the future to provide a Python interface, I need to be able to open projects, retrieve layouts, export layouts, access feature classes and features present in the layout.
... View more
10-08-2020
09:52 AM
|
0
|
0
|
485
|
POST
|
I am manipulating a Layout brought into memory using the ConvertLayoutFileToLayout() method. Once I have this Layout modified as I wish, is there a way to get it back into PAGX format? This is all happening in a script running outside of the Arc Pro GUI, but I want a user to be able to bring the modified Layout back into Arc Pro for viewing and further, manual modification.
... View more
04-01-2020
10:01 AM
|
0
|
0
|
267
|
POST
|
I have a Layout that contains various graphic elements. I want to get the symbol from a specific graphic element in order to apply it to the renderer of a layer within a map in a mapFrame in the Layout. In the .NET SDK, this is fairly simple - you can reference graphicElement.Graphic.Symbol (which is a CIMSymbolReference), and then assign that Symbol to the Symbol property of a CIMUniqueValueClass. The corresponding logic in ArcPy would be to assign something to the symbol property of an Item, which is part of an ItemGroup, which exists within the groups property of your UniqueValueRenderer. However, I'm not seeing any way to get the specific symbol that a specific graphic element is using. The documentation for symbol says, "The easiest way to update a symbol is to use the applySymbolFromGallery method." But what if we can't do that? The symbol I'm interested in isn't necessarily a stock, named symbol, but a symbol the user may have customized on their layout before this whole rendering process takes place. Is there some way to access what I need through the CIM (within Python)? If so, how would I take that CIM object and convert it into a Symbol object that can be assigned to an Item?
... View more
03-31-2020
12:55 PM
|
0
|
0
|
281
|
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 |