|
POST
|
Hi, Try code below. It works for me. protected override async void OnClick()
{
var featLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().First();
await QueuedTask.Run(() =>
{
var render = featLayer.GetRenderer() as CIMSimpleRenderer;
var cimVisualVariableInfoXY = new CIMVisualVariableInfo
{
RandomMax = 360,
RandomMin = 0,
VisualVariableInfoType = VisualVariableInfoType.None
};
var cimExpressionInfoZ = new CIMExpressionInfo
{
Title = "Custom",
ReturnType = ExpressionReturnType.Default,
Expression = "$feature.Direction"
};
var cimVisualVariableInfoZ = new CIMVisualVariableInfo
{
RandomMax = 360,
RandomMin = 0,
VisualVariableInfoType = VisualVariableInfoType.Expression,
ValueExpressionInfo = cimExpressionInfoZ
};
var listCIMVisualVariables = new List<CIMVisualVariable>
{
new CIMRotationVisualVariable {
VisualVariableInfoX = cimVisualVariableInfoXY,
VisualVariableInfoY = cimVisualVariableInfoXY,
VisualVariableInfoZ = cimVisualVariableInfoZ,
RotationTypeZ=SymbolRotationType.Arithmetic,
NormalToSurface = false
}
};
render.VisualVariables = listCIMVisualVariables.ToArray();
featLayer.SetRenderer(render);
});
}
... View more
02-07-2024
01:37 AM
|
2
|
2
|
1910
|
|
POST
|
Could you please specify more information about ArcGIS Pro version and database type? There are some issues with GetDefinition method in ArcGIS Pro 3.2 and PostgreSql database. More info here.
... View more
01-30-2024
08:49 AM
|
0
|
1
|
3267
|
|
POST
|
I would recommend you to check selectedFeatureLayer for OID type field using code below: var fieldDescriptions = selectedFeatureLayer.GetFieldDescriptions();
var oidField = fieldDescriptions.Find(x => x.Type == FieldType.OID);
if(oidField != null)
{
var oidName = oidField.Name;
}
... View more
01-26-2024
12:34 PM
|
0
|
3
|
3333
|
|
POST
|
Hi, Your assembly must exists inside esriAddinX file. Before execution your esriAddinX file will be moved to cache folder then extracted. Open your compiled esriAddinX file with archiver as archive. Step inside Install folder. Your assembly must be located here.
... View more
01-25-2024
10:25 PM
|
0
|
1
|
1743
|
|
POST
|
Try to set FrameworkApplication.Current.MainWindow as owner for MessageBox.
... View more
01-23-2024
03:54 AM
|
0
|
1
|
1928
|
|
POST
|
Hi, 1. MessageBox should be called from UI thread, because RowEvent callbacks are always called on the QueuedTask. If you could get your Progress Dialog window handler, you could use MessageBox Show method overload with window handler. 2. I have tried cancel edit on sample below and it reverts back value in Attribute Table window, but not in Attribute Dockpane. It could be issue with Attribute Dockpane. protected override void OnClick()
{
//run on MCT
QueuedTask.Run(() =>
{
var mapLayers = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>();
foreach (var layer in mapLayers)
{
var layerTable = layer.GetTable();
RowChangedEvent.Subscribe(onRowEvent, layerTable);
RowCreatedEvent.Subscribe(onRowEvent, layerTable);
RowDeletedEvent.Subscribe(onRowEvent, layerTable);
}
});
}
private void onRowEvent(RowChangedEventArgs obj)
{
obj.CancelEdit();
}
... View more
01-23-2024
03:36 AM
|
0
|
3
|
1936
|
|
POST
|
Hi, Look at the thread. You can make a search in ArcGIS Pro SDK Questions and you will find answers for the most of your questions.
... View more
01-22-2024
03:50 AM
|
0
|
0
|
2187
|
|
POST
|
Hi, It could show that your tool was not started for not valid parameters or invalid tool path/name. Try to use GPTool Execute Event Handler to get more information about tool execution. System.Threading.CancellationTokenSource _cts;
string ozone_points = @"C:\data\ca_ozone.gdb\O3_Sep06_3pm";
string[] args = { ozone_points, "OZONE", "", "in_memory\\raster", "300",
"EMPIRICAL", "300", "5", "5000",
"NBRTYPE=StandardCircular RADIUS=310833.272442914 ANGLE=0 NBR_MAX=10 SECTOR_TYPE=ONE_SECTOR",
"PREDICTION", "0.5", "EXCEED", "", "K_BESSEL" };
string tool_path = "ga.EmpiricalBayesianKriging";
_cts = new System.Threading.CancellationTokenSource();
var result = await Geoprocessing.ExecuteToolAsync(tool_path, args, null, _cts.Token,
(event_name, o) => // implement delegate and handle events
{
switch (event_name)
{
case "OnValidate": // stop execute if any warnings
if ((o as IGPMessage[]).Any(it => it.Type == GPMessageType.Warning))
break;
case "OnProgressMessage":
string msg = string.Format("{0}: {1}", new object[] { event_name, (string)o });
System.Windows.MessageBox.Show(msg);
break;
case "OnProgressPos":
string msg2 = string.Format("{0}: {1} %", new object[] { event_name, (int)o });
System.Windows.MessageBox.Show(msg2);
break;
}
});
var ret = result;
_cts = null;
... View more
01-21-2024
10:41 PM
|
0
|
0
|
1168
|
|
POST
|
Hi, Your code implements creation of RasterLayer form lyrx file. Try line below to create raster layer from path: var rasterLayer = LayerFactory.Instance.CreateLayer(new Uri(outputdata), groupLayer) as RasterLayer; More info in ArcGIS Pro SDK API Reference
... View more
01-21-2024
10:32 PM
|
0
|
1
|
1694
|
|
POST
|
Yes, you are right I have checked inheritance of FeatureCollectionTable, but didn't read until the end. FeatureCollectionLayer may not help you too. What do you think about changing your package and send coordinates of the path as json or geojson string? You will need to add additional geoprocessing step to package content for converting json/geojson string to features.
... View more
01-18-2024
10:31 AM
|
1
|
1
|
2071
|
|
POST
|
Hi, Look at the question . Main idea would be to switch to GUI thread and set Label_1 Content property: Application.Current.Dispatcher.Invoke(() =>
{
Label_1.Content = "some text";
});
... View more
01-16-2024
02:04 AM
|
2
|
1
|
1471
|
|
POST
|
Hi, Look at the LayerSnapModes sample. It uses ActiveMapViewChangedEvent, LayersAddedEvent and LayersRemovedEvent to populate snap list.
... View more
01-12-2024
09:04 AM
|
1
|
1
|
1726
|
|
POST
|
@KenBujais right about "async" and "await". As I understand you use SpatialAnalyst ExtractByMask tool. There is a small difference in parameters calling from python and c#, because ExtractByMask returns result raster. Calling ExtractByMask tool from c# you need to find right place for output raster path parameter. Spatial Analyst use few different approaches for output parameters: it could be in second place or last one. More info here public async Task<bool> ExtractByMask(RasterLayer _inputRaster, FeatureLayer _maskLayer, string _outRaster)
{
var valueArray = Geoprocessing.MakeValueArray(_inputRaster, _maskLayer, _outRaster);
// or
//var valueArray = Geoprocessing.MakeValueArray(_inputRaster, _outRaster, _maskLayer);
var gpResult = await Geoprocessing.ExecuteToolAsync("ExtractByMask_sa", valueArray, flags: GPExecuteToolFlags.AddOutputsToMap);
return !gpResult.IsFailed;
} I would recommend to use that overload of ExecuteToolAsync. It will get you more information about executing tool. Sample from that page: System.Threading.CancellationTokenSource _cts;
string ozone_points = @"C:\data\ca_ozone.gdb\O3_Sep06_3pm";
string[] args = { ozone_points, "OZONE", "", "in_memory\\raster", "300",
"EMPIRICAL", "300", "5", "5000",
"NBRTYPE=StandardCircular RADIUS=310833.272442914 ANGLE=0 NBR_MAX=10 SECTOR_TYPE=ONE_SECTOR",
"PREDICTION", "0.5", "EXCEED", "", "K_BESSEL" };
string tool_path = "ga.EmpiricalBayesianKriging";
_cts = new System.Threading.CancellationTokenSource();
var result = await Geoprocessing.ExecuteToolAsync(tool_path, args, null, _cts.Token,
(event_name, o) => // implement delegate and handle events
{
switch (event_name)
{
case "OnValidate": // stop execute if any warnings
if ((o as IGPMessage[]).Any(it => it.Type == GPMessageType.Warning))
_cts.Cancel();
break;
case "OnProgressMessage":
string msg = string.Format("{0}: {1}", new object[] { event_name, (string)o });
System.Windows.MessageBox.Show(msg);
_cts.Cancel();
break;
case "OnProgressPos":
string msg2 = string.Format("{0}: {1} %", new object[] { event_name, (int)o });
System.Windows.MessageBox.Show(msg2);
_cts.Cancel();
break;
}
});
var ret = result;
_cts = null; OnValidate you will get info about parameters validity.
... View more
01-10-2024
09:39 AM
|
0
|
0
|
2471
|
|
POST
|
Hi, Could you please add the code as text ("..." on toolbar and "</>" on extended toolbar)? It would be easier to correct your code.
... View more
01-10-2024
08:07 AM
|
0
|
0
|
2549
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 1 | 07-21-2026 10:23 PM | |
| 1 | 06-30-2026 10:14 PM | |
| 1 | 06-30-2026 01:43 PM | |
| 2 | 04-24-2026 08:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
Monday
|