|
POST
|
If you don't want the service layer credits to show up on your map you can place them anywhere on your layout as a text element. You can do this via the ArcGIS Pro UI or programmatically: String slcText = "<dyn type='layout' name='SLCs' property='serviceLayerCredits'/>";
GraphicElement slcTxtElm = ElementFactory.Instance.CreateTextGraphicElement(layout, TextType.RectangleParagraph, slcEnv, arial8reg, slcText);
... View more
09-11-2023
02:34 PM
|
0
|
1
|
1150
|
|
POST
|
How many fields and records do you have in your table?
... View more
09-11-2023
01:56 PM
|
0
|
0
|
1045
|
|
POST
|
You can take a look at this sample: arcgis-pro-sdk-community-samples/Geometry/MultipatchBuilderEx at master · Esri/arcgis-pro-sdk-community-samples (github.com) and search for 'Triangle'. The sample constructs multipatch geometries from triangles.
... View more
09-05-2023
07:43 AM
|
0
|
0
|
799
|
|
POST
|
I fixed your snippet above. I guess the main issue was that the CancelableProgressor parameter for ExecuteToolAsync is missing. protected override async void OnClick()
{
var done = await ProcessSpatialJoin(@"Crimes", @"Portland Precincts", @"C:\Data\Interacting with Maps\Interacting with Maps.gdb\Crimes_SpatialJoin", "50 Yards");
MessageBox.Show($@"Process done: {done}");
}
public static async Task<bool> ProcessSpatialJoin(string target_feats, string join_feats, string output_feats, string search_radius)
{
//https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic10957.html
var progDlg = new ProgressDialog("Running spatial join", "Cancel");
progDlg.Show();
var progsrc=new CancelableProgressorSource(progDlg);
//System.Windows.MessageBox.Show("Progress bar show");
var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);
var parameters = await QueuedTask.Run(() =>
{
var join_operation = "JOIN_ONE_TO_ONE";
var match_option = "INTERSECT";
var field_map = "";
return Geoprocessing.MakeValueArray(target_feats, join_feats, output_feats, join_operation,
"KEEP_COMMON", field_map, match_option, search_radius);
});
GPExecuteToolFlags flags = GPExecuteToolFlags.AddOutputsToMap | GPExecuteToolFlags.GPThread | GPExecuteToolFlags.AddToHistory;
var toolResult = await Geoprocessing.ExecuteToolAsync("SpatialJoin_analysis", parameters, environments, progsrc.CancellationTokenSource.Token, null, flags);
//// dialog hides itself once the execution is complete
//progDlg.Hide();
//System.Windows.MessageBox.Show("Progress bar hide");
if (toolResult.IsFailed == true)
{
Geoprocessing.ShowMessageBox(toolResult.Messages, "GP Messages", toolResult.IsFailed ?
GPMessageBoxStyle.Error : GPMessageBoxStyle.Default);
}
return !(toolResult.IsFailed);
} I tried with release 3.0 as well and it worked with 3.0 too:
... View more
09-04-2023
11:52 PM
|
0
|
1
|
5209
|
|
POST
|
This code worked for me: try
{
var progDlg = new ProgressDialog("Running Geoprocessing Tool", "Cancel");
var progsrc=new CancelableProgressorSource(progDlg);
// prepare input parameter values to CopyFeatures tool
string input_data = @"C:\Data\Admin\AdminSample.gdb\TestArea";
string out_workspace = ArcGIS.Desktop.Core.Project.Current.DefaultGeodatabasePath;
string out_data = System.IO.Path.Combine(out_workspace, "TestArea2");
// make a value array of strings to be passed to ExecuteToolAsync
var parameters = Geoprocessing.MakeValueArray(input_data, out_data);
// execute the tool
await Geoprocessing.ExecuteToolAsync("management.CopyFeatures", parameters,
null, new CancelableProgressorSource(progDlg).Progressor, GPExecuteToolFlags.Default);
// dialog hides itself once the execution is complete
progDlg.Hide();
}
catch (Exception ex)
{
MessageBox.Show (ex.ToString ());
} the difference is that i set the 'delayedShow' parameter for the ProgressDialog constructor to false (not specifying that parameter causes it to be set to false), and i removed the progDlg.Show() line.
... View more
08-31-2023
12:44 PM
|
0
|
1
|
4089
|
|
POST
|
@GKmieliauskas is quite correct as you need to implement your own states and conditions to control your Add-in's UI. There is a ProGuide to states and conditions here: ProGuide Code Your Own States and Conditions · Esri/arcgis-pro-sdk Wiki (github.com) Then in your add-in's module class you can check for the existence of the needed Add-in using the FrameworkApplication API: var theNeededModule = FrameworkApplication.FindModule("NeededModule"); The Module ID "NeededModule" can be found in the Add-in module's config.daml file: ...
<modules>
<insertModule id="NeededModule" className="Module1" autoLoad="false" ...>
If theNeededModule value is null the needed add-in is not available otherwise the needed add-in is available. You can use that value to control your states and conditions.
... View more
08-30-2023
10:42 AM
|
0
|
0
|
1135
|
|
POST
|
Can you elaborate why a button would be missing from the UI? Is the Add-in not installed ? If the Add-in is installed why would the button be missing? I don't understand your use case for this.
... View more
08-30-2023
08:20 AM
|
0
|
1
|
1142
|
|
POST
|
As I understand, the 'Field Calculator' run as a GP Tool. So you can try this setting: Or programmatically: SetEnableUndoOn Method—ArcGIS Pro Either way seemed to work for me:
... View more
08-23-2023
02:20 PM
|
0
|
0
|
1154
|
|
POST
|
In theory that should work but you have to make sure not to specify a specific version of the OpenXML dll since an upgrade of ArcGIS Pro could ship with a newer release of OpenXML.
... View more
08-23-2023
06:28 AM
|
0
|
2
|
2892
|
|
POST
|
I actually tried to create an Add-in sample that writes an XML file using ClosedXML and was not able to get it to work properly. After some testing it turns out that one of the dependencies of ClosedXML is DocumentFormat.OpenXML which is already included with ArcGIS Pro in the ArcGIS Pro bin folder. I was unable to find a matching release of ClosedXML, so i wrote my sample using DocumentFormat.OpenXML instead. The trick here is that you have to reference the DocumentFormat.OpenXML.dll file in the ArcGIS Pro bin folder and to NOT include the DocumentFormat.OpenXML NuGet. Using the NuGet might lead to another version mismatch. Also when including the OpenXML reference make sure that no specific version is listed and the copy local setting is false. I attached my sample project.
... View more
08-22-2023
02:49 PM
|
0
|
3
|
2901
|
|
POST
|
The attached solution (should work with 3.0) has two options: one with a code-behind implementation and one with a XAML based implementation that is using a value converter.
... View more
08-22-2023
12:06 PM
|
0
|
0
|
1129
|
|
POST
|
A similar question came up before - you can also do this: Build and run this sample: arcgis-pro-sdk-community-samples/Framework at master · Esri/arcgis-pro-sdk-community-samples (github... Scroll down on the link above to get instructions on how to run the sample. This will give you the most complete list of Pro Images. Starting with 3.1 the syntax on how to use Pro Internal Images changed a bit (internally all images were converted into vector graphics), and you can find instructions on how to reference Pro internal images here: ProGuide Content and Image Resources · Esri/arcgis-pro-sdk Wiki (github.com)
... View more
08-21-2023
09:45 AM
|
0
|
0
|
890
|
|
POST
|
If you implement your checkbox logic in the viewmodel as @GKmieliauskas suggests you have to prevent recursion when you set the counter property. Here is my suggestion (i attached a sample solution) private bool _isCheckedOne;
private bool _isCheckedTwo;
public bool IsCheckedOne
{
get { return _isCheckedOne; }
set
{
SetProperty(ref _isCheckedOne, value);
if (IsCheckedTwo == IsCheckedOne)
{
// prevent recursion
IsCheckedTwo = !IsCheckedOne;
}
}
}
public bool IsCheckedTwo
{
get { return _isCheckedTwo; }
set
{
SetProperty(ref _isCheckedTwo, value);
if (IsCheckedOne == IsCheckedTwo)
{
// prevent recursion
IsCheckedOne = !IsCheckedTwo;
}
}
}
... View more
08-21-2023
09:41 AM
|
0
|
0
|
1158
|
|
POST
|
This is a problem that has been identified with the 3.1 release and resolved for the 3.2 upcoming release. The cause was an issue with defining a custom stack size when managed threads and native threads are mixed. This issue was resolved in the underlying architecture of ArcGIS Pro and is therefore not suited for a 3.1 patch release.
... View more
08-21-2023
08:56 AM
|
0
|
4
|
2331
|
|
POST
|
You can use this snippet to delete all data from a layer: var theFeatureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
if (theFeatureLayer == null)
{
MessageBox.Show("Unable to find a FeatureLayer in the Table of Content");
return;
}
QueuedTask.Run(() =>
{
theFeatureLayer.GetTable().DeleteRows(new QueryFilter () );
}); and the code to copy data from one layer to another is included in the code above. // copy some data
await QueuedTask.Run(() =>
{
// create an edit operation
EditOperation copyOperation = new EditOperation()
{
Name = "Copy Data",
ProgressMessage = "Working...",
CancelMessage = "Operation canceled.",
ErrorMessage = "Error copying polygons",
SelectModifiedFeatures = false,
SelectNewFeatures = false
};
using var rowCursor = originalLayer.Search();
while (rowCursor.MoveNext())
{
using (var row = rowCursor.Current as Feature)
{
var geom = row.GetShape().Clone();
if (geom == null)
continue;
var newAttributes = new Dictionary<string, object>
{
{ "field1", 1.0 },
{ "field2", 2.0 }
};
copyOperation.Create(newLyr, geom, newAttributes);
}
}
// execute the operation onoy if changes where made
if (!copyOperation.IsEmpty
&& !copyOperation.Execute())
{
MessageBox.Show($@"Copy operation failed {copyOperation.ErrorMessage}");
return;
}
});
// check for edits
if (Project.Current.HasEdits)
{
var saveEdits = MessageBox.Show("Save edits?",
"Save Edits?", System.Windows.MessageBoxButton.YesNoCancel);
if (saveEdits == System.Windows.MessageBoxResult.Cancel)
return;
else if (saveEdits == System.Windows.MessageBoxResult.No)
_ = Project.Current.DiscardEditsAsync();
else
{
_ = Project.Current.SaveEditsAsync();
}
}
... View more
08-17-2023
12:56 PM
|
0
|
0
|
1292
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | yesterday | |
| 1 | 07-30-2025 12:03 PM | |
| 1 | 10-06-2025 01:19 PM | |
| 1 | 10-06-2025 10:37 AM | |
| 1 | 09-24-2025 09:12 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|