|
POST
|
In order to control your ArcGIS Pro custom tabs and controls you can use 'States and Conditions' as outlined here: ProConcepts Framework · Esri/arcgis-pro-sdk Wiki (github.com) There's a guide on how to do this here: ProGuide Code Your Own States and Conditions · Esri/arcgis-pro-sdk Wiki (github.com) and some sample code here: arcgis-pro-sdk-community-samples/Framework at master · Esri/arcgis-pro-sdk-community-samples (github.com) You would then in your code-behind find the portal user's group: PortalGroup Class—ArcGIS Pro and depending on the groups returned you can then either activate or deactivate the appropriate state. Finally, since Module Add-ins are loaded JIT (Just In Time) and by default are not loaded until the add-in module is required by the User Interface, you can change that behavior to load your module at startup as described here: ProConcepts Framework · Esri/arcgis-pro-sdk Wiki (github.com)
... View more
12-07-2022
06:05 AM
|
0
|
1
|
1551
|
|
POST
|
I was able to duplicate the issue with the Alias property not retaining its value between sessions even when i explicitly save the project. I reported this as an issue to the Framework dev team. Thanks for reporting this issue.
... View more
12-06-2022
07:03 AM
|
0
|
0
|
823
|
|
POST
|
This will work for lyrx files. Lyr file are from ArcGIS Desktop so i am not sure if 3.0 will still load those. protected override async void OnClick()
{
string url = @"c:\temp\Acme Service Roads.lpkx"; // load layer file
Uri uri = new Uri(url);
await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer(uri, MapView.Active.Map));
}
... View more
12-05-2022
03:30 PM
|
0
|
3
|
1740
|
|
POST
|
I think the problem is that you can't re-use the EditOperation that is initiating the OnRowCreated event. Also switching and awaiting threads in a Row event is not really recommended because this can lead to thread deadlocks. To reiterate your workflow: On a RowCreated event you need to present a user interface that allows the user to manipulate a value that is then used to update a field value in the newly created row. In order to do this i had to start the ProWindow on the UI thread after the OnRowEvent finished and then use a separate EditOperation to update the newly created row. I attached my sample project and please note that it is using C:\Data\FeatureTest\FeatureTest.aprx from the Community Sample GitHub page (Esri/arcgis-pro-sdk-community-samples: ArcGIS Pro SDK for Microsoft .NET Framework Community Samples (github.com)) Using the sample add-in i can initiate my event listener using the 'TestChainedUpdate' button: Creating a new row will trigger the OnRowCreated event, in the event code i remember the object id for the newly created record (for the later update) and initiate the ProWindow ShowDialog on the UI: protected void OnRowCreated(RowChangedEventArgs rowChanged)
{
Module1.UpdatedObjectId = rowChanged.Row.GetObjectID();
ProApp.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() =>
{
OpenPrinWindowInfoInput();
}));
} All the work is done in OpenPrinWindowInfoInput which is executed on the UI thread after the row has been created. Here is the code: private async void OpenPrinWindowInfoInput ()
{
// open the dialog, populate initial data to show and process result
var prowindowinfoinput = new ProWindowInfoInput();
prowindowinfoinput.Owner = FrameworkApplication.Current.MainWindow;
var proWinVm = new ProWindowInfoInputVM
{
RecordInfo = $@"Created Record's {Module1.UpdatedObjectIdField}: {Module1.UpdatedObjectId}"
};
prowindowinfoinput.DataContext = proWinVm;
prowindowinfoinput.Closed += (o, e) => { System.Diagnostics.Debug.WriteLine("Pro Window Dialog closed"); };
var dlgResult = prowindowinfoinput.ShowDialog();
if (dlgResult == true)
{
// user click Ok: update the newly created record with info input data
// load the inspector with the feature
await QueuedTask.Run(() =>
{
var insp = new Inspector();
insp.Load(_testLayer, Module1.UpdatedObjectId);
insp[UpdateField] = proWinVm.InfoData;
//create and execute the edit operation
var op = new EditOperation
{
Name = "Update newly created record",
SelectModifiedFeatures = false,
SelectNewFeatures = false
};
op.Modify(insp);
op.Execute();
});
}
} After i click 'update' in the ProWindow I use Inspector to get the newly created record and update the newly created record in a new EditOperation: Ideally i would like to use a Chained EditOperation here but i got an error trying to create a chained edit operation. However, the transaction is on undo/redo stack:
... View more
12-01-2022
08:23 AM
|
2
|
1
|
2279
|
|
POST
|
I duplicated the message that you are getting with my sample below. I had to rename the class name or the namespace of the button's code behind in order to get this message. The correct code in my code-behind will work fine: namespace SEAS.IENC.PICREP_TOOLS
{
internal class PICREPButton : Button
{
protected override void OnClick()
{
MessageBox.Show("test");
}
}
} But a renaming PICREPButton (which is case sensitive) will cause this message by Pro: er to get that message.
... View more
11-29-2022
02:43 PM
|
1
|
1
|
2105
|
|
POST
|
I think what you referring to is an 'add-in' not a 'plugin'. Add-ins are loaded 'JIT (Just In Time)' meaning that ArcGIS Pro doesn't run any of the 'add-in' code when Pro starts. Pro waits until the UI triggers some action (like a button click), then Pro will try to find the class that is associated with the button click (we refer to as the code-behind). Not seeing you add-in i can only speculate here, but it appears that Pro can't find the code behind on the AWS machine. This is often the case when the add-in DLL has been renamed but the DLL references in the config.daml were not updated accordingly. Or it is possible that your add-in threw an exception in the constructor. Not sure why this works on your development machine, but i would suggest that you have different add-ins installed on your dev machine. You can compare which add-ins are installed by using the 'Add-in Manager' menu under the 'Project' menu.
... View more
11-29-2022
08:38 AM
|
0
|
4
|
2140
|
|
POST
|
I created sample code that copies all vertices from a line layer (TestLines) into a point layer (PointsNoDuplicates) and then deletes all duplicates (with the same shape) using the "management.DeleteIdentical" GP tool. I used an addin with a button to test this code and a map that contained the required layers. protected override async void OnClick()
{
try
{
var lineLayerName = "TestLines";
var noDupPointLayerName = "PointsNoDuplicates";
FeatureLayer polyLine = MapView.Active.Map.GetLayersAsFlattenedList().FirstOrDefault(layer => layer.Name.Equals(lineLayerName)) as FeatureLayer;
FeatureLayer pointsNoDuplicates = MapView.Active.Map.GetLayersAsFlattenedList().FirstOrDefault(layer => layer.Name.Equals(noDupPointLayerName)) as FeatureLayer;
var ok = await QueuedTask.Run<bool>(() =>
{
var createFeatures = new EditOperation();
createFeatures.Name = "Add Points with duplicates";
//Create a feature for each point
using (var fc = polyLine.Search())
{
while (fc.MoveNext())
{
using (var feature = fc.Current as Feature)
{
var multiPart = feature.GetShape() as Multipart;
foreach (var point in multiPart.Points)
{
createFeatures.Create(pointsNoDuplicates, point);
}
}
}
}
//Execute to execute the operation
//Must be called within QueuedTask.Run
var result = createFeatures.Execute();
if (!result)
{
MessageBox.Show($@"Error creating points with duplicated: {createFeatures.ErrorMessage}");
}
return result;
});
if (!ok) return;
await Project.Current.SaveEditsAsync();
// Clear selection
await QueuedTask.Run (() => pointsNoDuplicates.ClearSelection());
// arcpy.management.DeleteIdentical(noDupPointLayerName, "Shape", "0.1 Meters", 0.1)
var paramsArray = Geoprocessing.MakeValueArray(noDupPointLayerName,
"Shape", "0.1 Meters", 0.1);
var delDupsDlg = new ProgressDialog("Delete Duplicates", "Cancel", 100, false);
var progsrc=new CancelableProgressorSource(delDupsDlg);
await Geoprocessing.ExecuteToolAsync("management.DeleteIdentical", paramsArray, null, progsrc.Progressor);
}
catch (Exception ex)
{
MessageBox.Show($@"{ex.Message}");
}
} Note that when i click my button repeatedly it will add the same points again (hence creating duplicates) which are then removed by the GP tool.
... View more
11-28-2022
12:15 PM
|
1
|
0
|
1502
|
|
POST
|
You have to describe your workflow in a bit more detail. For example, where are your MapPoints? In a graphic layer, in a feature layer, in memory? You are talking about 'uploading coordinates', I am not clear what that means. Do you have to check the 'dataset' to where you 'upload' your MapPoints for duplicates before you upload? If you have a feature class with MapPoints you suspect having duplicates you can use the 'Delete Identical (Data Management)' geoprocessing tool: Delete Identical (Data Management)—ArcGIS Pro | Documentation
... View more
11-22-2022
04:21 PM
|
0
|
1
|
1530
|
|
POST
|
Close the XAML document pane and see if the errors go away. There's an issue with the XAML designer not being able to open ArcGIS Pro assemblies and usually these types of errors are reported by the XAML designer in the Visual Studio Error List.
... View more
11-22-2022
01:42 PM
|
0
|
0
|
701
|
|
POST
|
You have to reset the progressor's value back to 0 between GP tasks. I also updated the Message string to show what GP Task is running. This worked for me: var mergeDlg = new ProgressDialog("Creating multiple buffers", "Cancel", 100, false);
var progsrc=new CancelableProgressorSource(mergeDlg);
progsrc.Message = "Creating inner buffer: step 1";
await Geoprocessing.ExecuteToolAsync("analysis.Buffer", valueArrays.InnerBuffer, null, progsrc.Progressor);
progsrc.Value = 0;
progsrc.Message = "Creating center buffer: step 2";
await Geoprocessing.ExecuteToolAsync("analysis.Buffer", valueArrays.CenterBuffer, null, progsrc.Progressor);
progsrc.Value = 0;
progsrc.Message = "Creating outer buffer: step 3";
await Geoprocessing.ExecuteToolAsync("analysis.Buffer", valueArrays.OuterBuffer, null, progsrc.Progressor); The screenshot below is taken while processing the last GP task. As you can see the progress dialog is still displaying.
... View more
11-17-2022
08:21 AM
|
0
|
0
|
1325
|
|
POST
|
What version of Pro are you using? I was not able to duplicate this issue using ArcGIS Pro version 3.0. I used createOperation.ExecuteAsync(); instead of the synchronous Execute method.
... View more
11-16-2022
02:32 PM
|
0
|
1
|
1161
|
|
POST
|
Charlie is correct here are some examples: MapView.Active.SelectFeatures(MapView.Active.Extent); or var selection = MapView.Active.SelectFeatures(clipPoly); You have to run the SelectFeatures method on the MCT meaning you have to use QueuedTask.Run as in the MapTool sample below: internal class MapTool1 : MapTool
{
public MapTool1()
{
IsSketchTool = true;
SketchType = SketchGeometryType.Polygon;
SketchOutputMode = SketchOutputMode.Map;
}
protected override Task OnToolActivateAsync(bool active)
{
return base.OnToolActivateAsync(active);
}
protected override async Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
// https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic11992.html
bool result = await QueuedTask.Run(() =>
{
var selectionSet = MapView.Active.SelectFeatures(geometry);
return true;
});
return result;
}
}
... View more
11-16-2022
07:56 AM
|
0
|
0
|
1608
|
|
POST
|
You should surround your code with try {} catch {} to see what errors you get. I can see at least one bug in this snippet: if (layer is BasicFeatureLayer)
{
FeatureLayer featureLayer = layer as FeatureLayer;
//THIS ONLY GETS CALLED ONCE - THEN NEVER AGAIN!
await QueuedTask.Run(() =>
{
var table = featureLayer.GetTable();
TableDefinition tableDefinition = table.GetDefinition();
string alias = tableDefinition.GetAliasName();
//do something here with alias name.....e.g.
System.Diagnostics.Debug.WriteLine($"The alias name is: {alias}");
});
} The problem is that AnnotationLayer, DimensionLayer and FeatureLayer all derive from BasicFeatureLayer. So in your code you check if layer is of the type 'BasicFeatureLayer' and if true you assign the casted layer to the featureLayer variable: var featureLayer = layer as FeatureLayer; Needless to say, your featureLayer variable will be null for Dimension or Annotation layers. Consequently, your code is using featureLayer without checking for null which will throw an exception. The code snippet will work for maps with no Dimension or Annotation layers.
... View more
11-15-2022
03:52 PM
|
2
|
0
|
1579
|
|
POST
|
The ArcGIS Pro SDK provides four main extensibility patterns: ArcGIS Pro Module Add-in, ArcGIS Pro Managed Configuration, ArcGIS Pro CoreHost Application, and ArcGIS Pro Plug-in Datasource. An add-in (ArcGIS Pro Module Add-in) allows the customization of the ArcGIS Pro UI through changes to the Tab / Ribbon UI, Buttons, Tools, Dockpane, etc. An ArcGIS Pro Managed Configuration includes all functionality of an add-in plus you can customize the ArcGIS Pro start page, splash screen, and it allows you to fully customize the Ribbon/Tab UI to streamline workflows. An ArcGIS Pro CoreHost Application is a standalone console application that only allows work with the Geodatabase and Geometry classes. There is no GUI for maps. The “ArcGIS Pro Plugin DataSource” extensibility pattern is used to integrate unsupported / custom data formats so that they can be viewed and mapped with ArcGIS Pro. So to answer your question there is no direct replacement for ArcEngine applications with the ArcGIS Pro SDK, the closest ArcGIS Pro SDK extensibility pattern would be a Managed Configuration. In general developers who had ArcEngine standalone applications are now looking at ArcGIS Runtime (ArcGIS Runtime API for .NET | ArcGIS Developers) To implement one of these patterns you can use the Visual Studio 2022 project
... View more
11-09-2022
04:04 PM
|
0
|
1
|
2125
|
|
POST
|
Just create a new add-in on your development machine which should have ArcGIS Pro 2.9.5 installed. Then open the config.daml of the newly created add-in and copy the desktopVersion attribute.
... View more
11-09-2022
09:55 AM
|
0
|
0
|
1890
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-07-2025 07:27 AM | |
| 2 | 2 weeks ago | |
| 1 | 07-30-2025 12:03 PM | |
| 1 | 10-06-2025 01:19 PM | |
| 1 | 10-06-2025 10:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
Sunday
|