|
POST
|
Go to the Analysis tab and open the Geoprocessing pane. From the Geoprocessing pane, select the tool and run it. Enter into/select on - the tool dialog whatever are the required parameters. Run a Geoprocessing tool
... View more
10-06-2022
03:04 PM
|
0
|
0
|
3005
|
|
POST
|
ExecuteToolAsync does not add behavior to a GP tool*. I'd recommend experimenting with the GP tool(s) via the UI to see if it can give u the behavior u want. If "yes" then whatever parameters/options u have set should be replicated in your code. If "no" then ExecuteToolAsync likely wont be able to suppress the behavior. *There are some GPExecuteToolFlags values which can be specified to control some aspects of GP behavior. These flags override any GP options set via the UI.
... View more
10-06-2022
08:24 AM
|
0
|
0
|
3022
|
|
POST
|
You want to use the LayerDocument class. Your workflow will be similar to that shown here in this code snippet: apply-symbology-to-a-layer-from-a-layer-file (there are also a number of other snippets on the LayerDocument reference page).
... View more
10-05-2022
10:18 AM
|
1
|
1
|
3381
|
|
POST
|
So width is a slightly ambiguous term. If you mean the width of the line symbol being used then the answer is it depends. If your features are being symbolized with a "simple" line symbol, then yes. Simply access the stroke layer(s) and retrieve the (max) width. The width will be in points and will need to be converted to the units of the map if you want the width in map units. For more complicated line symbology with multiple layers and various geometric offsets applied, visual variables, etc, etc then it could be much more difficult. So, this is the simple case, assuming a UVR and we are retrieving the overall max width - u will need to modify if u are interested in just the max width of a particular class (or group): //access the layer CIM Definition
//QTR.Run(()=> ...
var def = featLayer.GetDefinition() as CIMFeatureLayer;
var uvr = def.Renderer as CIMUniqueValueRenderer;
double maxWidth = 0.0;
foreach (var group in uvr.Groups) {
foreach (var valclass in group.Classes) {
var symbol = valclass.Symbol as CIMLineSymbol;
if (symbol == null) continue;
var sym_layers = ((CIMLineSymbol)symbol).SymbolLayers.ToList();
foreach (var sl in sym_layers) {
//assuming no offsets, etc.
if (sl is CIMStroke stroke) {
maxWidth = Math.Max(maxWidth, stroke.GetWidth());
//TODO - convert width in points to map units as needed
public static class CIMStrokeExtensions {
public static double GetWidth(this CIMStroke cimstroke) {
if (cimstroke is CIMSolidStroke)
return ((CIMSolidStroke) cimstroke).Width;
else if (cimstroke is CIMPictureStroke)
return ((CIMPictureStroke)cimstroke).Width;
else if (cimstroke is CIMGradientStroke)
return ((CIMGradientStroke)cimstroke).Width;
return 0;
} You could also attempt to calculate the width using the graphic outline - a polygon generated from the feature and its renderer that "matches" the graphical outline of the given feature (whether point, line, poly, or anno). Essentially, the outline polygon is equivalent to the masking polygon for "that" feature. The mask polygon will take into consideration all aspects of the renderer + visual variables, etc. so it is much more sophisticated but...it is a polygon and it is not necessarily straightforward to derive the feature "width" depending on the underlying shape/curvature of a particular line. To retrieve the graphical outline of a feature: featLayer.GetDrawingOutline(....) (note: this was QueryDrawingOutline at 2.x but the usage was the same) //QTR.Run(()=> ..
var outline = featLayer.QueryDrawingOutline(oid, MapView.Active,
DrawingOutlineType.Exact) as Polygon;
... View more
09-30-2022
10:48 AM
|
1
|
1
|
2379
|
|
POST
|
I assume u mean the graphics added to a layout or graphics layer? At Pro 3.0+ use: ArcGIS.Desktop.Layouts.Events.ElementEvent ArcGIS.Desktop.Layouts.Events.ElementEventArgs.Hint of ElementEventHint.PlacementChanged so, something like: ArcGIS.Desktop.Layouts.Events.ElementEvent.Subscribe((args) => {
var elems = args.Container.GetSelectedElements();
switch (args.Hint){
...
case ElementEventHint.PlacementChanged:
//TODO - handle element move if the elements are
//graphic elements
... View more
09-28-2022
03:13 PM
|
0
|
1
|
1288
|
|
POST
|
Stephen, i cover symbology in quite some depth here: ArcGIS Pro SDK for .NET: An Introduction to the Use of the CIM with Symbology in Pro (from Dev summit 2021) and, specifically, arrow heads: 48:30 ish ppt and code is here: https://esri.github.io/arcgis-pro-sdk/techsessions/2021/PalmSprings/CIMSymbology.zip You will need to use something called a CIMMarkerPlacementAtExtremities and apply that to your arrow marker. Along these lines (no pun intended): var symbol_layers = new List<CIMSymbolLayer>();
var stroke = SymbolFactory.Instance.ConstructStroke(
ColorFactory.Instance.BlackRGB, 2.0);
//End arrow
var arrow = SymbolFactory.Instance.ConstructMarker(
63, "ESRI Arrowhead", "Regular", 10) as CIMCharacterMarker;
//Marker placement on end - Both, JustBegin, JustEnd
var endMarkerPlacement = new CIMMarkerPlacementAtExtremities() {
ExtremityPlacement = ExtremityPlacement.JustEnd,
PlacePerPart = false,
AngleToLine = true
};
arrow.MarkerPlacement = endMarkerPlacement;
//reverse Z-order
symbol_layers.Add(arrow);
symbol_layers.Add(stroke);
var CIMLineSymbol = new CIMLineSymbol() {
SymbolLayers = layers.ToArray()
};
... View more
09-21-2022
08:16 AM
|
0
|
1
|
2833
|
|
POST
|
Daniel, take a look at this sample. It basically does what u want: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/MapToolWithOverlayControl Money lines are here: https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Map-Exploration/MapToolWithOverlayControl/ShowCoordinatesTool.cs#L60-L61 (ps, this is a MapTool not a Button. There is no callback for a button)
... View more
09-20-2022
01:53 PM
|
1
|
0
|
1414
|
|
POST
|
the opposite. The search on the feature layer _does_ use recycling
... View more
09-16-2022
02:23 PM
|
1
|
0
|
2658
|
|
POST
|
Karen, looks like there is a MinWidth set by the style so u have to override that. Here's an example: <UserControl x:Class="....>
<UserControl.Resources>
...
</UserControl.Resources>
<Grid>
...
<WrapPanel Orientation="Horizontal" VerticalAlignment="Bottom">
<Button Content="30" Width="30" MinWidth="30" Style="{DynamicResource Esri_Button}" Margin="2" VerticalAlignment="Center"/>
<Button Content="40" Width="40" MinWidth="40" Style="{DynamicResource Esri_Button}" Margin="2" VerticalAlignment="Center"/>
<Button Content="50" Width="50" MinWidth="50" Style="{DynamicResource Esri_Button}" Margin="2" VerticalAlignment="Center"/>
<Button Content="60" Width="60" MinWidth="60" Style="{DynamicResource Esri_Button}" Margin="2" VerticalAlignment="Center"/>
<Button Content="70" Width="70" Style="{DynamicResource Esri_Button}" Margin="2" VerticalAlignment="Center"/>
<Button Content="80" Width="80" Style="{DynamicResource Esri_Button}" Margin="2"
VerticalAlignment="Center"/>
<Button Content="90" Width="90" Style="{DynamicResource Esri_Button}" Margin="2" VerticalAlignment="Center"/>
<Button Content="100" Width="100" Style="{DynamicResource Esri_Button}" Margin="2" VerticalAlignment="Center"/>
</WrapPanel>
</Grid>
</UserControl>
... View more
09-16-2022
02:13 PM
|
1
|
1
|
3550
|
|
POST
|
Hi Vidar, there are various options for caching credentials with Pro but not programmatically via the API. Consult the Pro help for more info, but generally speaking, it revolves around the "Sign me in automatically" checkbox on the Pro Sign in popup. https://pro.arcgis.com/en/pro-app/latest/help/projects/sign-in-to-your-organization.htm Also, I believe if the portal is configured for IWA, sign in is automatic regardless (assuming user login and portal login match).
... View more
09-16-2022
07:27 AM
|
0
|
0
|
670
|
|
POST
|
I'll keep u posted. An internal bug issue has been created. It is also an issue with the UI too, fyi. If you want a BUG number to track then if u submit an issue to tech support, they will give u an external number that would get linked with the internal bug for tracking purposes. Otherwise, I'll update this thread when the bug is fixed. As currently, that would be 3.1, otherwise 3.2. Thanks Stephen
... View more
09-08-2022
09:09 AM
|
0
|
0
|
3114
|
|
POST
|
So I think this is a bug. I notice that if I change the alias when the field is _not_ visible in the Table View the table view does not refresh correctly (when I set the field back to being visible). That said, as a workaround, do you have to actually dynamically change the alias name? Instead, can you set both field alias' to be "MyAtt" upfront and then simply toggle visibility between the two based on whatever is your underlying criteria?....the end result being the same - that only one or the other is shown. That worked for me - I set two columns to have the same alias upfront and then toggled visibility between one and then the other. The view correctly switched between the two columns, each w the same alias name, as their underlying visibility was toggled.
... View more
09-07-2022
02:17 PM
|
0
|
1
|
3143
|
|
POST
|
stephen, i cannot repro on 3.0 this is the OnClick code i used in my test button - it is toggling a (random) field's visibility on a standalone table and each time the table view refreshes to show/hide the particular field protected override void OnClick() {
var table = MapView.Active.Map.GetStandaloneTablesAsFlattenedList()
.FirstOrDefault(t => t.Name == "GreatLakes_Table");
QueuedTask.Run(() =>
{
var fld_descs = table.GetFieldDescriptions();
var fld_desc = fld_descs.FirstOrDefault(f => f.Alias == "CScode");
fld_desc.IsVisible = !fld_desc.IsVisible;
table.SetFieldDescriptions(fld_descs);
});
}
... View more
09-07-2022
08:34 AM
|
0
|
1
|
3151
|
|
POST
|
I believe query layers have a data connection that contains an extent property that u can set via the CIM. In the case of a query layer, it may be null by default as the software probably wants to avoid doing a full table scan to calculate it ....thus, I assume the layer extent gets defaulted to something v large - probably the map's default extent or similar.... As a workaround, perhaps u could create the layer with visibility off then set the extent u desire, turning visibility on at the same time. "Zoom to Layer", I believe, will also honor any extent u set. Here's a snippet that does something along those lines that u can play with: //elsewhere - compute extent envelope as needed...
var extent = EnvelopeBuilderEx.CreateEnvelope(x_min, y_min, x_max, y_max);
var feat_layer = LayerFactory.Instance.CreateLayer(....) as FeatureLayer;
QueuedTask.Run(() => {
//Get the CIM Definition
var def = feat_layer.GetDefinition() as CIMFeatureLayer;
def.Visibility = true; //make the layer visible
var sql_conn = def.FeatureTable.DataConnection as CIMSqlQueryDataConnection;
if (sql_conn != null) {
//Set the extent - honored by "Zoom to Layer", etc.
sql_conn.Extent = extent;
}
feat_layer.SetDefinition(def);//commit the changes
}); Zoom to Layer should use the extent, also: Additionally, "Recalculate Feature Class Extent" gp tool provides an option to store the calc'd extent as part of an unregistered table (aka query layer) at the db level. The next time you add a query layer, it should read the extent off the table's metadata without recalc or need to set the extent programmatically.
... View more
09-06-2022
11:57 AM
|
0
|
0
|
842
|
|
POST
|
This has been added to the API on LayoutView class at the next release 3.1. In the meantime, u can use this code snippet as a basis for a workaround. 4 conditions must be true in order to activate a map frame: 1. You must be on the UI thread 2. The Layout view (containing the relevant map frame) must be the active view 3. The map frame to be activated must be the LayoutView.Active.ActiveMapFrame 4. The LayoutView.Active.ActiveMapFrame.Map must not be null (meaning it has an empty map frame) If these conditions are met you can invoke the "esri_layouts_activateMap" command which will activate the LayoutView.Active.ActiveMapFrame. internal class ActivateMapFrameBtn: Button {
protected override void OnClick()
{
//1. must be on the GUI - dont switch to QueuedTask
//2. Layout view must be active!
if (LayoutView.Active == null)
return;
//3. LayoutView.Active.ActiveMapFrame is the frame that will
// be activated
var map_frameName = "Map Frame";
if (LayoutView.Active.ActiveMapFrame == null ||
LayoutView.Active.ActiveMapFrame.Name != map_frameName) {
//simply select it to make it the active one
var selFrame = LayoutView.Active.Layout.GetElementsAsFlattenedList()
.OfType<MapFrame>().FirstOrDefault(mf => mf.Name == map_frameName);
if (selFrame == null)
return; //not found
LayoutView.Active.Layout.SelectElement(selFrame);
}
//4. Does the ActiveMapFrame have a valid map?
if (LayoutView.Active.ActiveMapFrame?.Map == null)
return; //invalid map frame - probably empty
//esri_layouts_activateMap - activate
//esri_layouts_deactivateMap - deactivate
//Do the activation
var plugin =
FrameworkApplication.GetPlugInWrapper("esri_layouts_activateMap")
as System.Windows.Input.ICommand;
if (plugin.CanExecute(null))
plugin.Execute(null);
}
}
... View more
09-06-2022
11:09 AM
|
2
|
1
|
1978
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-19-2026 10:29 AM | |
| 1 | 04-29-2026 02:06 PM | |
| 1 | 01-08-2026 02:03 PM | |
| 1 | 01-08-2026 02:15 PM | |
| 3 | 12-17-2025 11:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-31-2026
09:30 AM
|