POST
|
In ArcGIS Pro you don't have to define the class breaks manually anymore. Instead, you simply specify the Classification Method. In the snippet below ClassificationMethod.NaturalBreaks is used. The Geodatabase API provides some functionality to get table statistics like standard deviation. You can find some information here: ProConcepts Geodatabase · Esri/arcgis-pro-sdk Wiki (github.com) internal static Task CBRendererGraduatedSymbols()
{
//Check feature layer name
//Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(f => f.Name == "USDemographics");
if (featureLayer == null)
{
MessageBox.Show("This renderer works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
return Task.FromResult(0);
}
return QueuedTask.Run(() =>
{
GraduatedSymbolsRendererDefinition gsDef = new GraduatedSymbolsRendererDefinition()
{
ClassificationField = SDKHelpers.GetNumericField(featureLayer), //getting the first numeric field
ClassificationMethod = ClassificationMethod.NaturalBreaks,
SymbolTemplate = SymbolFactory.Instance.ConstructPointSymbol(CIMColor.CreateRGBColor(76,230,0)).MakeSymbolReference(),
MinimumSymbolSize = 4,
MaximumSymbolSize = 50,
BreakCount = 5,
ColorRamp = SDKHelpers.GetColorRamp(), //getting a color ramp
};
CIMClassBreaksRenderer renderer = (CIMClassBreaksRenderer)featureLayer.CreateRenderer(gsDef);
featureLayer?.SetRenderer(renderer);
});
} You can find more about Renderers here: arcgis-pro-sdk-community-samples/Map-Authoring/Renderer at master · Esri/arcgis-pro-sdk-community-samples (github.com)
... View more
09-25-2023
02:24 PM
|
2
|
1
|
460
|
POST
|
can you provide the Add-in button's config.daml line and also the location and the properties of the image that you are referencing in the config.daml?
... View more
09-22-2023
07:39 AM
|
0
|
1
|
1187
|
POST
|
Here are a few things to consider: - Did Project.Current.SaveEditsAsync() return true? - Do you see the newly added data in the table view in ArcGIS Pro ? - Is your GeoDatabase versioned? If so that might explain why you don't see the data using SQL Server.
... View more
09-21-2023
04:27 PM
|
0
|
2
|
542
|
POST
|
I usually do a rebuild after i change the config.daml ... I can't recall why. But if that doesn't work check if you have any other instances of ArcGIS Pro running.
... View more
09-18-2023
11:41 AM
|
0
|
1
|
1216
|
POST
|
There is no need to downgrade to 3.0 ... migrating your 2.7 project to 3.1 should work as well as migrating to 3.0. If you have a 3.1 project and you want to develop / run on 3.0 then you have to make a change in the config.daml under the AddInInfo tag by changing the 'desktopVersion' attribute to 3.0.0. <AddInInfo id="..." version="1.01" desktopVersion="3.0.36056">
... View more
09-17-2023
12:32 PM
|
0
|
1
|
1232
|
POST
|
Sorry i forgot to include the GetScreenPointsInMapUnits method in my snippet above. private double GetScreenPointsInMapUnits (double pixels, MapView mapView)
{
var left = new Point(0, 0);
var right = new Point(0, pixels);
var pntLeft = mapView.ClientToMap(left);
var pntRight = mapView.ClientToMap(right);
var line = LineBuilderEx.CreateLineSegment (pntLeft, pntRight);
return line.Length;
} In essence the method takes the tolerance in screen units (i.e. pixels) and returns the tolerance in units for the current active map's spatial reference. So when i generate the circle geometry for the search i can then use toleranceInMapUnits as the radius for the circle.
... View more
09-14-2023
03:44 PM
|
0
|
0
|
502
|
POST
|
Thanks for pointing out the issue with the sample, i will correct the issue for the upcoming 3.2 release. This code uses a circle around the click point using the pixel tolerance as the radius: // pixel tolerance
var toleranceInScreenUnits = 10;
// Use bottomRight to popup the dynamic menu result
bottomRight = new Point(clickedPnt.X + toleranceInScreenUnits, clickedPnt.Y + toleranceInScreenUnits);
var toleranceInMapUnits = GetScreenPointsInMapUnits(toleranceInScreenUnits, MapView.Active);
// Create a search circle around the click point using the pixel tolerance as a radius
var pnt = MapView.Active.ClientToMap(new Point(clickedPnt.X, clickedPnt.Y));
var arcSegment = EllipticArcBuilderEx.CreateCircle(pnt.Coordinate2D, toleranceInMapUnits, ArcOrientation.ArcClockwise, pnt.SpatialReference);
var circlePolygon = PolygonBuilderEx.CreatePolygon(new[] { arcSegment });
//Get the features that intersect the search circle polygon
var result = ActiveMapView.GetFeatures(circlePolygon); Here is a screenshot that show the search polygon on the map:
... View more
09-13-2023
02:47 PM
|
0
|
1
|
515
|
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
|
531
|
POST
|
How many fields and records do you have in your table?
... View more
09-11-2023
01:56 PM
|
0
|
0
|
438
|
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
|
423
|
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
|
2748
|
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
|
2240
|
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
|
606
|
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
|
613
|
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
|
532
|
Title | Kudos | Posted |
---|---|---|
1 | 06-03-2020 09:11 AM | |
1 | 11-27-2023 10:24 AM | |
1 | 04-13-2023 03:09 PM | |
1 | 07-22-2024 03:36 PM | |
1 | 05-24-2024 10:13 AM |
Online Status |
Offline
|
Date Last Visited |
Tuesday
|