POST
|
Gintautas, Thank You for your reply. Have a Good Day
... View more
10-18-2022
11:27 AM
|
0
|
0
|
736
|
POST
|
Thank You... This worked perfectly. Nice little piece of code.
... View more
10-18-2022
11:26 AM
|
0
|
0
|
738
|
POST
|
Ken, After researching this a bit more. It is simple to remove the layer added to the ToC. The Create Raster Dataset does meet my needs. MapView.Active.Map.RemoveLayer(layerToRemove);
... View more
10-18-2022
10:31 AM
|
0
|
0
|
429
|
POST
|
Ken, Thanks for your reply. This does create a raster in memory... but also adds the layer to the ToC by default... and there does not appear to be a setting that prevents the layer from being added to the ToC. Thus, a person has to go through and manually remove the layer from the ToC. Close to fitting the need... but not quit.
... View more
10-18-2022
10:01 AM
|
0
|
2
|
431
|
POST
|
Goal --- Hide Attribute Fields in an attribute table Given a feature class with an attribute table, how would attribute fields be programmatically shown/hidden? Places already researched... ProSnippets Editing · Esri/arcgis-pro-sdk Wiki (github.com) ArcGIS.Desktop.Editing.Controls Namespace—ArcGIS Pro
... View more
10-16-2022
04:44 PM
|
0
|
5
|
802
|
POST
|
Is there a way to create a BasicRasterLayer and hold it in memory to be used as an intermediate in a raster calculation? The code below is slightly modified from: https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-MapAuthoring#create-a-raster-layer The container needs to be "memory" instead of MapView.Active.Map BasicRasterLayer rasterLayer = null;
await QueuedTask.Run(() =>
{
rasterLayer = LayerFactory.Instance.CreateLayer<BasicRasterLayer>(rasterLayerCreationParams, MapView.Active.Map);
});
... View more
10-16-2022
01:17 PM
|
0
|
5
|
491
|
POST
|
Gintautas, Excellent help. The last solution was the best. It is better than the example provided by ESRI because similar code works for a Folder Connect, Style and Toolbox. I did change my code to use the last solution for all 3 items. Nice and elegant solution.
... View more
10-13-2022
11:58 AM
|
0
|
0
|
350
|
POST
|
Gintautas, Thank You... the above code works well to add a style. However... there does not appear to be a similar method to add a custom toolbox. As I am trying to do in lines 20 through 26 of my code. Do you have a suggestion to add a custom toolbox with C# code?
... View more
10-12-2022
10:56 AM
|
0
|
2
|
376
|
POST
|
Goal - Create an add-in button that populates a new project with a Folder Connection, a Custom Style and a Custom Tools Lines 3 through 9 below run correctly and were copied from: ProSnippets Content · Esri/arcgis-pro-sdk Wiki (github.com) After modifying the example code to work with a "Style" instead of a "Folder Connection". An exception is thrown on line 16... System.NullReferenceException Message=Object reference not set to an instance of an object. Thus, if I read the exception correctly, an object of StyleProjectItem is not instantiated or the return is left as null. Reading through the API documentation... IProjectItem Interface—ArcGIS Pro The Overview -> Remarks state, "These classes also follow a convention that includes "ProjectItem" as part of their name" Based upon the stated convention... it appears like StyleProjectItem should be instantiated correctly. protected override async void OnClick()
{
string folderPath = "C:\\Data";
var folder = await QueuedTask.Run(() =>
{
var itemFolder = ItemFactory.Instance.Create(folderPath) as IProjectItem;
return Project.Current.AddItem(itemFolder) ? itemFolder as FolderConnectionProjectItem : null;
});
FavoritesManager.Current.AddFavorite(folder);
string stylePath = "C:\\Data\\CustomStyles.stylx";
var style = await QueuedTask.Run(() =>
{
var itemStyle = ItemFactory.Instance.Create(stylePath) as IProjectItem;
return Project.Current.AddItem(itemStyle) ? itemStyle as StyleProjectItem : null;
});
FavoritesManager.Current.AddFavorite(style);
string paToolBoxPath = "C:\\Data\\CustomTools.tbx";
var toolBox = await QueuedTask.Run(() =>
{
var itemTool = ItemFactory.Instance.Create(paToolBoxPath) as IProjectItem;
return Project.Current.AddItem(itemTool) ? itemTool as GeoprocessingProjectItem : null;
});
FavoritesManager.Current.AddFavorite(toolBox);
}
}
... View more
10-10-2022
10:24 AM
|
0
|
4
|
419
|
POST
|
Wolf... Thank You very much. I was missing one line. Sometimes the obvious is right in front of us and we don't see it. listLabelClasses.Add(labelSelectedFeaturesWithLength);
... View more
09-21-2022
03:23 PM
|
1
|
0
|
480
|
POST
|
The goal is to format feature class labels using a Text Symbol style item from a custom Style static async Task SetToTextStyle(FeatureLayer featureLayer, string zValueField, string layerName)
{
string style = "Style1";
string labelStyleName = "Label1";
await QueuedTask.Run(() =>
{
IList<SymbolStyleItem> labelStyleItem = GetLabelStyleFromStyle(Project.Current, style, labelStyleName);
var labelStyle = labelStyleItem[0];
// Need to go from a SymbolStyleItem above to a CIMTextSymbol below.
CIMTextSymbol textSymbol = SymbolFactory.Instance.ConstructTextSymbol();
CIMSymbolReference symbolReferance = textSymbol.MakeSymbolReference();
CIMLabelClass labelClass = new CIMLabelClass()
{
ExpressionEngine = LabelExpressionEngine.Arcade,
Expression = $"\"pH \" + textformatting.newline + $feature.pH", //probably not correct format
TextSymbol = symbolReferance,
Visibility = true
};
CIMFeatureLayer layerDefinition = featureLayer.GetDefinition() as CIMFeatureLayer;
// Code below taken from community sample
// This code appears to do the same thing as line 17
List<CIMLabelClass> listLabelClasses = layerDefinition.LabelClasses.ToList();
CIMLabelClass theLabelClass = listLabelClasses.FirstOrDefault();
featureLayer.SetDefinition(layerDefinition);
featureLayer.SetLabelVisibility(true);
});
}
... View more
09-21-2022
11:14 AM
|
0
|
2
|
503
|
IDEA
|
It would be good if the settings chosen with the "Symbol Gallery Option" button persisted. Default shown below: Non-Default settings below: It is easy to change these setting once... but if ArcGIS Pro is opened several times per day... it quickly becomes a pain to always have to change the settings from default.
... View more
09-19-2022
07:10 PM
|
2
|
0
|
174
|
POST
|
The following error is generated when raster.IsExpanded is tried. How can raster.IsExpanded be used. By the way... I found "IsExpanded" with the CIMViewer. 🙂 RasterLayer raster = null;
await QueuedTask.Run(() =>
{
raster = LayerFactory.Instance.CreateLayer<RasterLayer>(rasterLayerCreationParams, map);
});
await SetToClassifyColorizer(raster);
raster.IsExpanded
... View more
09-16-2022
06:58 PM
|
0
|
1
|
262
|
POST
|
Thank You very much. That worked. I will download the CIMViewer and play with it.
... View more
09-16-2022
07:10 AM
|
0
|
0
|
537
|
Title | Kudos | Posted |
---|---|---|
1 | 09-21-2022 03:23 PM | |
2 | 09-19-2022 07:10 PM | |
1 | 09-02-2020 08:45 AM | |
3 | 03-27-2022 12:05 PM | |
2 | 07-23-2018 12:46 PM |
Online Status |
Offline
|
Date Last Visited |
03-12-2024
03:28 PM
|