|
POST
|
Hi Sai, I am not able to duplicate any problems with activation of a mapview pane unless it is done in a tight loop with no user interaction with the mapview pane (other than just displaying and activating it). To activate a mapview pane you can lift the code from this sample: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/OpenMapViews and you can then do your custom processing on the active map view. Once you're done with your 'custom processing' and done saving your map, you can then repeat the same cycle for the next item. I have not seem any issues with this workflow, maybe if you can elaborate what type of processing you are doing i can try to duplicate the issue. There are plenty of issues that could be the cause of a hang but the pane activation for this type of workflow is not the reason.
... View more
06-10-2020
12:42 PM
|
0
|
1
|
3034
|
|
POST
|
Hi Lars, I think a sample would help to look at your issue. If you'd rather email please use [email protected] and make sure to delete both bin and obj folders before you zip the projects. I did a similar code sample before, but the output was stored as a multi patch geometry. If you want to try MultiPatch geometries to see if that works, you can look at this sample: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/OverlayGroundSurface (specifically 'Make Ring MultiPatch' with guidance from here: https://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic27403.html ).
... View more
06-10-2020
10:56 AM
|
1
|
3
|
4964
|
|
POST
|
Besides the issue regarding the map pane initialization and activation, i think the you can implement your workflow, saving all maps in a common folder', because it is possible without first showing a map view pane. You can save the maps as follows: protected override async void OnClick()
{
var pathToSaveFiles = @"c:\temp\maps";
if (!System.IO.Directory.Exists(pathToSaveFiles))
{
System.IO.Directory.CreateDirectory(pathToSaveFiles);
}
var mapProjItems = Project.Current.GetItems<MapProjectItem>();
try
{
await QueuedTask.Run(() =>
{
foreach (var mapPro in mapProjItems)
{
mapPro.GetMap().SaveAsFile(System.IO.Path.Combine(pathToSaveFiles, $@"{mapPro.Name}.mapx"));
}
});
}
catch (Exception ex)
{
MessageBox.Show($@"Error: {ex}");
}
MessageBox.Show("Done");
} I attached the sample project I used to duplicate your issued and also this code. If you want to run the sample, you need to download and use the 'C:\Data\Admin\AdminSample.aprx' project which comes with the community sample dataset here: https://github.com/Esri/arcgis-pro-sdk-community-samples/releases then click the 'CreateMaps' button followed by the 'SaveMaps' button which saves the map files to c:\temp\maps.
... View more
06-09-2020
04:11 PM
|
0
|
3
|
3034
|
|
POST
|
The selection is returned as a Dictionary of MapMembers and the list of selected object ids for each MapMember. In order words: Dictionary<MapMamber, List<long>>. Once you know the inheritance relationship between MapMember and FeatureLayer (in essence that FeatureLayer inherits from MapMember) - this is from the online help: you can now search the Dictionary returned by GetSelection for the specific FeatureLayer (or MapMember) you are looking for. Below is a button click sample looking to the number of selected records in the 'TestPoints' layer. protected override async void OnClick()
{
var map = MapView.Active?.Map;
if (map == null) return ;
var layerName = "TestPoints";
var searchThisLayer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name.Equals(layerName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (searchThisLayer == null)
{
MessageBox.Show($@"Cannot find this layer: {layerName}");
return;
}
var noIds = await QueuedTask.Run<List<long>>(() =>
{
// this returns a dictionary of MapMembers and a list of ObjectIDS for that MapMember's selection
// Here is helps to know that a FeatureLayer inherits from BasicFeatureLayer, which inherits
// from Layer, which inherits from MapMember
// So if we are looking only for one FeatureLayer's selection then we can use 'searchThisLayer'
// to check the return dictionary of MapMembers
var listOfMapMemberDictionaries = MapView.Active.Map.GetSelection();
if (!listOfMapMemberDictionaries.ContainsKey(searchThisLayer as MapMember))
{
// Selection Dictionary doesn't a 'searchThisLayer' MapMember
return new List<long>();
}
return listOfMapMemberDictionaries[searchThisLayer as MapMember];
});
MessageBox.Show($@"This layer: {searchThisLayer.Name} has {noIds.Count} selected items");
}
... View more
06-09-2020
01:58 PM
|
1
|
1
|
3091
|
|
POST
|
I duplicated your issue with my sample add-in, I can create one or two (at most) map panes before the [map pane creation] thread will hang. I am checking with the developers for any workarounds.
... View more
06-08-2020
01:50 PM
|
0
|
0
|
3034
|
|
POST
|
I think the following sample implements what you want to do: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/OpenMapViews
... View more
06-08-2020
09:43 AM
|
0
|
0
|
3034
|
|
POST
|
You can use the Observable Collection of Items (which includes maps) of the Project class: ArcGIS Pro 2.5 API Reference Guide in order to listen for change events. Make sure to check that the added/removed item is a Map since folders, layouts, etc. are all Project Items.
... View more
06-05-2020
12:49 PM
|
0
|
0
|
1335
|
|
POST
|
The snippet I sent should work fine for your workflow: My workflow is using a point (either from a geometry from the selected feature in our address table or from a lat/long entered into the form) that will be intersected with our Township/Range/Section featureclass, subdivision featureclass, and assessor featureclass to return the TRS, subdivision, block and property owner information. This resulting attributes will be used to populate the attributes in the target featureclass (well permits). If you use the snippet (above) with your input Point Geometry (either from a geometry from the selected feature in our address table or from a lat/long entered into the form) as the FilterGeometry in the SpatialQueryFilter the Search on each layer will give you all the features that contain that Point Geometry. You can then simply use that feature to extract the attributes you need to update (or add) your well permit feature.
... View more
06-03-2020
11:11 AM
|
0
|
1
|
5650
|
|
POST
|
I can't tell from your question what kind of workflow you are looking for, but below is some sample code that uses a 'line geometry' to search through a polygon layer to find all polygons that are intersected by that line geometry. Then using each intersecting polygon it uses the Intersection method to get the actual geometry resulting from the intersection between line and polygon geometry. Maybe this will help you further, i pulled the code from an upcoming 2.6 sample. try
{
var mapView = MapView.Active;
if (mapView == null) return;
// select the first line feature layer in the active map
// we use that line to find all
var lineLayer = mapView.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>()
.Where(lyr => lyr.ShapeType == esriGeometryType.esriGeometryPolyline).FirstOrDefault();
if (lineLayer == null)
{
MessageBox.Show("Line layer missing from scene");
return;
}
// select the polygon feature layer in the active map
var polygonLayer = mapView.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>()
.Where(lyr => lyr.ShapeType == esriGeometryType.esriGeometryPolygon).FirstOrDefault();
if (polygonLayer == null)
{
MessageBox.Show("Polygon layer missing from scene");
return;
}
_ = QueuedTask.Run(() =>
{
var selection = lineLayer.GetSelection();
if (selection.GetCount() == 0)
{
MessageBox.Show("No Line feature has been selected");
return;
}
Geometry lineGeometry = null;
using (var selCursor = selection.Search())
{
if (selCursor.MoveNext())
{
lineGeometry = (selCursor.Current as Feature).GetShape().Clone();
}
}
// define the spatial query filter to get all intersecting features from polygon layer
var spatialQuery = new SpatialQueryFilter()
{
FilterGeometry = lineGeometry,
SpatialRelationship = SpatialRelationship.Intersects
};
// Fine intersecting features
var rowCursor = polygonLayer.Search(spatialQuery);
while (rowCursor.MoveNext())
{
using (var feature = rowCursor.Current as Feature)
{
var geomInterectingPolygon = feature.GetShape().Clone();
var resultGeom = GeometryEngine.Instance.Intersection(geomInterectingPolygon,
lineGeometry);
if (resultGeom.IsEmpty)
{
MessageBox.Show("result geometry is empty");
return;
}
MessageBox.Show($@"Result geometry type: {resultGeom.GeometryType} pnt count: {resultGeom.PointCount}");
}
}
return;
});
}
catch (Exception ex)
{
MessageBox.Show($@"Error: {ex}");
}
... View more
06-03-2020
09:11 AM
|
1
|
0
|
5650
|
|
POST
|
Hi Marvis, Currently the sole purpose of the CIMRouteEventDataConnection class is to expose some properties on a 'Route Event Layer'. However, if you take a look at the comments in this 'idea post' this might be of help to you: https://community.esri.com/ideas/13766
... View more
05-28-2020
01:27 PM
|
0
|
0
|
2481
|
|
POST
|
Hi Helen, It appears that you are not using MVVM which is the programming pattern used by Dockpanes in the Pro SDK. MVVM is programming pattern not specific to the Pro SDK and is used in many Enterprise implementations for WPF desktop applications. If you look at this question: https://community.esri.com/message/922908-re-access-listview-inside-dockpane?commentID=922908#comment-922908 it explains the issue that you are running into. In order to implement a button (or command) for example you have to use the ICommand pattern by implementing a public property that implements the ICommand Interface in the ViewModel. Remember all your code goes into the ViewModel not in the View's (xaml.cs) code behind file. So don't double click a button control to implement an 'OnClick' handler, there are no handlers in MVVM. I attached a 2.5 sample that implements a listbox, a textbox, and a set of buttons in MVVM. Remember the the View (your XAML) and the ViewModel (your code in the viewmodel.cs file) are linked by using Data Binding. So the public properties in your ViewModel code have to have a corresponding property with {Binding property_name}. In the ViewModel code you would use either SetProperty or NotifyPropertyChanged in order to make a change (with is normally in the setter of the property) to either your list or any other property (see for example the ListItem class in my sample). Using SetProperty or NotifyPropertyChanged will ensure that the UI (your XAML) is notified that your data (properties) has changed and the UI can now update the control on the display.
... View more
05-20-2020
11:13 AM
|
1
|
1
|
2195
|
|
POST
|
Currently the only way to implement web solutions that contain Geodatabase-related API functionality is to build either an Enterprise SDK SOE/SOI (see link below for details) and publish these services on the ArcGIS Server platform. Enterprise SDK SOE (which is basically a custom service hosted on ArcGIS Server) can utilize the same Geodatabase-related API as your ArcGIS Pro Add-in. For more info please check the link below and make sure to select the .Net API reference and not Java: https://developers.arcgis.com/enterprise-sdk/
... View more
05-15-2020
11:07 AM
|
0
|
1
|
1198
|
|
POST
|
That's correct. Things like edit operations, geometry manipulations, etc. that don't require user interaction you would always run from within the context of QueuedTask.Run - first to keep the UI responsive, but also because most of these API operations require that they run on the MCT. If you have to interact with user input or you call an asynchronous 'Async' method (like for example Project.SaveAsync) you can do this from the UI thread. If you would write your own asynchronous function like let's say you write your own SaveProjectAsync method, then you would use QueuedTask.Run in the implementation of that method - like it was demonstrated in the video listed above.
... View more
05-13-2020
03:25 PM
|
2
|
0
|
9550
|
|
POST
|
You can read about using QueuedTask here: https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Framework#using-queuedtask. Calling QueuedTask.Run multiple times in a row will only hurt performance. But in essence QueuedTask is used to encapsulate your business logic processing in order to keep the UI responsive. Also this YouTube video covers the basics starting from 26 minutes into the presentation: ArcGIS Pro SDK for .NET: Beginning Pro Customization and Extensibility - YouTube
... View more
05-13-2020
01:41 PM
|
0
|
2
|
9550
|
|
POST
|
The OverlayGroundSurface sample in the "ArcGIS Pro SDK Community Samples" GitHub Repo is using GetZsFromSurfaceAsync. It should work for a single point. However, I think you have to specify the correct spatial reference when you create your test point.
... View more
05-13-2020
09:08 AM
|
1
|
1
|
1233
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-29-2025 10:48 AM | |
| 1 | 05-24-2021 09:04 AM | |
| 1 | 12-03-2020 08:44 AM | |
| 1 | 10-07-2025 07:27 AM | |
| 2 | 12-29-2025 10:03 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-21-2026
01:59 PM
|