|
POST
|
Hi, One way to accomplish this is to - Create a custom application property that holds the values for these folder connections. Then on project open event execute your logic to add these connections to the project. Thanks Uma
... View more
08-08-2019
06:33 AM
|
1
|
3
|
2526
|
|
POST
|
Hi Chris At this time, time slider settings are only read when the MapView is opened. We are looking into the possibility of enhancing this so that they would be applied on the SetDefinition call and not just when the view is opened. Thanks Uma
... View more
08-02-2019
08:27 PM
|
0
|
1
|
1042
|
|
POST
|
Hi Gintautas, Not sure what is happening here - I tried with the raster dataset you shared previously that had the "Value" field and this code works for me. The Colorizer method has an issue with assigning colors in the specified ramp - This is an issue that we hope to fix in the next release. Renderers that use color ramps do not have this issue. Thanks Uma
... View more
07-30-2019
08:59 AM
|
0
|
4
|
4558
|
|
POST
|
Hi Gintautas The issue is that the CreateColorizer does not systematically assign colors from the associated color ramp. We are looking into addressing it in the future. In the meantime, here is some code that can help solve this issue. internal class SetColorizer : Button
{
protected async override void OnClick()
{
var raster = MapView.Active.Map.GetLayersAsFlattenedList().OfType<RasterLayer>().FirstOrDefault();
if (raster == null)
return;
await QueuedTask.Run(async () =>
{
string colorBrewerSchemesName = "ArcGIS Colors";
var colorRampNames = new List<string>() { "Green Blues", "Bathymetry #1", "Bathymetry #3",
"Cyan to Purple", "Inferno", "Aspect"};
var color_index = new Random().Next(0, colorRampNames.Count - 1);
string fieldName = "Value";
var colorizer = await CreateUniqueValueColorizerAsync(
raster, colorBrewerSchemesName, colorRampNames[color_index], fieldName);
raster.SetColorizer(RecalculateColorizer(colorizer));
});
}
public CIMRasterColorizer RecalculateColorizer(CIMRasterColorizer colorizer)
{
if (colorizer is CIMRasterUniqueValueColorizer uvrColorizer)
{
var colorRamp = uvrColorizer.ColorRamp;
if (colorRamp == null)
throw new InvalidOperationException("Colorizer must have a color ramp");
//get the total number of colors to be assigned
var total_colors = uvrColorizer.Groups.Select(g => g.Classes.Count()).Sum();
var colors = ColorFactory.Instance.GenerateColorsFromColorRamp(colorRamp, total_colors);
var c = 0;
foreach(var uvr_group in uvrColorizer.Groups)
{
foreach (var uvr_class in uvr_group.Classes)
{
//assign the generated colors to each class in turn
uvr_class.Color = colors[c++];
}
}
}
else if (colorizer is CIMRasterClassifyColorizer classColorizer)
{
var colorRamp = classColorizer.ColorRamp;
if (colorRamp == null)
throw new InvalidOperationException("Colorizer must have a color ramp");
var total_colors = classColorizer.ClassBreaks.Count();
var colors = ColorFactory.Instance.GenerateColorsFromColorRamp(colorRamp, total_colors);
var c = 0;
foreach(var cbreak in classColorizer.ClassBreaks)
{
//assign the generated colors to each class break in turn
cbreak.Color = colors[c++];
}
}
return colorizer;
}
public static Task<CIMRasterColorizer> CreateUniqueValueColorizerAsync(
BasicRasterLayer basicRasterLayer, string styleName, string colorRampName, string fieldName)
{
return QueuedTask.Run(async () =>
{
//we just assume that all of this works and doesn't return null anywhere.. ;-)
var style = Project.Current.GetItems<StyleProjectItem>().First(s => s.Name == styleName);
var ramps = style.SearchColorRamps(colorRampName);
var colorizerDef = new UniqueValueColorizerDefinition(fieldName, ramps[0].ColorRamp);
return await basicRasterLayer.CreateColorizerAsync(colorizerDef);
});
}
}
}
... View more
07-29-2019
08:37 PM
|
1
|
6
|
4558
|
|
POST
|
Hi Vladimir Pro loads the systems fonts directly at startup. Can you give me a little more information as to how you are trying to use or "See" the system fonts in Pro? Is it via an add-in? Can you please share a code snippet if so. For example, here is the Pro's labeling properties dockpane. I am able to see all my system fonts. I installed news fonts and when I launch pro subsequently, I "See" those fonts. Thanks Uma
... View more
07-27-2019
06:43 PM
|
0
|
1
|
13355
|
|
POST
|
Hi Davood This did not get addressed at 2.4. We are looking into getting this addressed at 2.5. I will post to this thread when I have an update. Thanks Uma
... View more
07-23-2019
06:39 PM
|
0
|
0
|
1328
|
|
POST
|
Hi Brain Check out this wiki page for some information on add-in loading schemes: Add-in Loading Scheme Another thing that you could use is the versioning scheme adopted by add-ins. This is also listed in the same wiki page. The section below is an extract from the wiki page. You could increment your "developer add-in" to have a higher version, thus forcing Pro to load your add-in, instead of the one on the network share. Extract from wiki regarding versioning: version version is the version of the add-in or configuration and is metadata provided to the add-in or configuration author for their own use. It should be edited by hand as necessary. If multiple versions of the same Add-in are installed on the same machine (eg in different well-known folders) then the latest add-in version is the version that will be loaded regardless of the order in which the well-known folders and default user folder are processed. Version comparison is evaluated for Major.Minor.Build.Revision components. For example: Assuming no issues with desktopVersion : Two versions of an add-in are installed on a system. One DAML contains version=1.0.3 . One DAML contains version=1.1.0.0 . The version=1.1.0.0 of the add-in will be the version that loads. Assuming no issues with desktopVersion : Two versions of an add-in are installed on a system. One DAML contains version=1.4 . One DAML contains version=3.0 . The version=3.0 of the add-in will be the version that loads. Thanks Uma
... View more
07-19-2019
11:36 AM
|
3
|
1
|
815
|
|
POST
|
Hi Gintautas, When you use the code, is the issue that the 3 colors chosen by the code doesn't match the colors chosen by the same action accomplished by the Symbology dockpane UI? I need to confirm this, but that might be how the code behaves - It randomly picks 3 colors which are different than what the Pro UI does. Thanks Uma
... View more
07-19-2019
11:13 AM
|
0
|
8
|
4558
|
|
POST
|
Hi Gintautas, I used your methods and sample raster dataset and it seemed to work for me. Only thing I added to my code was GetColorRampsFromStyleAsync method.Since it was async, I awaited it (line 29 in the snippet below)and it created the correct Colorizer in Pro. private static async Task<IList<ColorRampStyleItem>> GetColorRampsFromStyleAsync()
{
string colorRampName = "Muted pastels";
//string colorRampStyle = "ArcGIS Colors";
string colorBrewerSchemesName = "ArcGIS Colors";
StyleProjectItem style = Project.Current.GetItems<StyleProjectItem>().First(s => s.Name == colorBrewerSchemesName);
IList<ColorRampStyleItem> colorRampList = await QueuedTask.Run(() =>
{
return style.SearchColorRamps(colorRampName);
});
return colorRampList;
}
public static async Task SetToUniqueValueColorizer(BasicRasterLayer basicRasterLayer)
{
// Creates a new UV Colorizer Definition using the default constructor.
string fieldName = "Value";
// Sets the newly created colorizer on the layer.
await QueuedTask.Run(async () =>
{
IList<ColorRampStyleItem> rampList = await GetColorRampsFromStyleAsync();
CIMColorRamp colorRamp = rampList[0].ColorRamp;
UniqueValueColorizerDefinition UVColorizerDef = new UniqueValueColorizerDefinition(fieldName, colorRamp);
// Creates a new UV colorizer using the colorizer definition created above.
CIMRasterUniqueValueColorizer newColorizer = await basicRasterLayer.CreateColorizerAsync(UVColorizerDef) as CIMRasterUniqueValueColorizer;
basicRasterLayer.SetColorizer(newColorizer);
});
} Can you please this? Thanks Uma
... View more
07-18-2019
08:09 PM
|
0
|
10
|
4558
|
|
POST
|
Hi Gintautas Kmieliauskas Please do attach your raster and I can check it out. Thanks Uma
... View more
07-17-2019
07:37 PM
|
0
|
12
|
4558
|
|
POST
|
Hi I am assuming that your flight data will have its current position and orientation as attributes. If so, you can use "Attribute Driven symbology". The data has to be Z enabled 3D data. This will allow you to use Pro's Symbology Rotation attributes. You will also then have the capability to access the "Vary symbology by attributes" property page to drive your flight path using your data's fields. Using the Pro SDK, here is a snippet that will accomplish this: protected override void OnClick()
{
var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
QueuedTask.Run( () => {
var renderer = lyr.GetRenderer() as CIMSimpleRenderer;
var cimExpressionInfoX = new CIMExpressionInfo { Expression = "$feature.X" };
var cimVisualVariableInfoX = new CIMVisualVariableInfo { VisualVariableInfoType = VisualVariableInfoType.Expression, ValueExpressionInfo = cimExpressionInfoX };
var cimExpressionInfoY = new CIMExpressionInfo { Expression = "$feature.Y" };
var cimVisualVariableInfoY = new CIMVisualVariableInfo { VisualVariableInfoType = VisualVariableInfoType.Expression, ValueExpressionInfo = cimExpressionInfoY };
var cimVisualVariableInfoZ = new CIMVisualVariableInfo { VisualVariableInfoType = VisualVariableInfoType.None };
var listCIMVisualVariables = new List<CIMVisualVariable>
{
new CIMRotationVisualVariable {
VisualVariableInfoX = cimVisualVariableInfoX,
VisualVariableInfoY = cimVisualVariableInfoY,
VisualVariableInfoZ = cimVisualVariableInfoZ
}
};
renderer.VisualVariables = listCIMVisualVariables.ToArray();
lyr.SetRenderer(renderer);
});
} Thanks Uma
... View more
07-14-2019
10:55 AM
|
1
|
1
|
677
|
|
POST
|
Hi The problem is that when you are applying the symbology, the layer has not been added to the map yet. When I tested the workflow in your snippet, I see the same issue. Try this: 1. Create the layer and await. 2. Then apply the symbology. This code does this: protected override async void OnClick()
{
string url = @"E:\Stuff\ApplySymbology\fs1";
var lyrFile = @"C:\Users\uma2526\Documents\ArcGIS\Projects\RasterColorizer\FS-Prediction.lyrx";
var rasterLyr = await QueuedTask.Run(() =>
{
return (RasterLayer)LayerFactory.Instance.CreateLayer(new Uri(url), MapView.Active.Map);
});
await QueuedTask.Run(() => {
var lyrDocFromLyrxFile = new LayerDocument(lyrFile);
var cimLyrDoc = lyrDocFromLyrxFile.GetCIMLayerDocument();
//Get the renderer from the layer file
var rendererFromLayerFile = ((CIMRasterLayer)cimLyrDoc.LayerDefinitions[0]).Colorizer as CIMRasterClassifyColorizer;
//Apply the renderer to the feature layer
rasterLyr?.SetColorizer(rendererFromLayerFile);
});
} Thanks Uma
... View more
07-14-2019
10:10 AM
|
2
|
1
|
2036
|
|
POST
|
Hi, This is what I did - In the zip file there was a prediction.lyr file. At this point in 2.4, the new methods to apply symbology using the layer definitions from a .lyr doesn't work with 2.4. This will hopefully be fixed soon. I added the prediction.lyr to Pro, fixed the data source by pointing to the grid layer you sent. I then saved it as a lyrx file. I have attached this lyrx file as FS-Prediction.lyrx. This lyrx file had a CIMRasterClassifyColorizer. I then used the code below to apply the symbology from FS-Prediction.lyrx to the grid you sent and it worked for me. Note: the lyrx was not loaded in Pro when I did this. protected override async void OnClick()
{
var lyrs = MapView.Active.Map.GetLayersAsFlattenedList().OfType<RasterLayer>();
await ModifyLayerSymbologyFromLyrFileAsync(lyrs, @"C:\Users\uma2526\Documents\ArcGIS\Projects\RasterColorizer\FS-Prediction.lyrx");
}
private static async Task ModifyLayerSymbologyFromLyrFileAsync(IEnumerable<RasterLayer> featureLayers, string layerFile)
{
await QueuedTask.Run(() =>
{
foreach (var featureLayer in featureLayers)
{
//Get the Layer Document from the lyrx file
var lyrDocFromLyrxFile = new LayerDocument(layerFile);
var cimLyrDoc = lyrDocFromLyrxFile.GetCIMLayerDocument();
//Get the renderer from the layer file
//This lyr file has a unique value renderer.
var rendererFromLayerFile = ((CIMRasterLayer)cimLyrDoc.LayerDefinitions[0]).Colorizer as CIMRasterClassifyColorizer;
//Apply the renderer to the feature layer
featureLayer?.SetColorizer(rendererFromLayerFile);
}
});
} Please let me know if this is similar to the workflow you are want. Thanks Uma
... View more
07-11-2019
08:46 AM
|
0
|
3
|
2036
|
|
POST
|
Hi Tim, You will need to create a Pro Dockpane for this. There are a few examples in the community samples that illustrate this. The Create Sample uses layers and field selection in a dockpane: Thanks Uma
... View more
07-10-2019
08:13 AM
|
1
|
1
|
1442
|
|
POST
|
Hi Yes, please do send it - I can check it out to see what is happening. Thanks Uma
... View more
07-10-2019
08:05 AM
|
0
|
5
|
2036
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-18-2025 03:09 PM | |
| 1 | 11-04-2025 08:25 AM | |
| 1 | 09-23-2025 09:31 AM | |
| 1 | 11-20-2024 10:50 AM | |
| 1 | 04-28-2025 03:06 PM |
| Online Status |
Offline
|
| Date Last Visited |
4 weeks ago
|