|
POST
|
Hi Than, Have you tried to look at snippets page? https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Raster There are few snippets with RasterCursor and PixelBlock
... View more
08-19-2019
02:32 AM
|
0
|
2
|
1539
|
|
POST
|
Hi Uma, The only one difference in our code is obtaining RasterLayer. You take it from map, in my add-in I create it from LayerFactory. I will check is it work by taking from map.
... View more
07-31-2019
05:58 AM
|
0
|
0
|
1548
|
|
POST
|
Hi Khamilie, I use combobox in my custom ribbon, but I call my own method to update combobox content. But you need to know the place where or when your combobox content changes. I created property for combobox in my add-in module class MyComboBox. Set it in combobox constructor: MyModule.Current.MyComboBox = this; And somewhere call method to update: MyModule.Current.MyComboBox.UpdateComboboxContent();
... View more
07-30-2019
12:02 AM
|
2
|
1
|
2219
|
|
POST
|
Hi Uma, Thank you for your efforts. Now it works with my text field, but doesn’t work with “Value” field. There is no view of the layer as in my picture in previous answer. The same things with recalculating colorizer we do in ArcObjects. So nothing changes ☺ It is strange that unique value rendering works fine on featureclasses without recalculating values. Thanks again.
... View more
07-29-2019
11:13 PM
|
0
|
5
|
8360
|
|
POST
|
Hi, I would like to use ArcGIS Pro SDK ProgressDialog with Cancel button for long process with iterations. After some iterations I see that my process results reached some suitable values and I don't want to wait until the end of process. I press Cancel button and want to write results to file geodatabase. I get error "Edit operation failed.". If I wait until end of process all works fine. I checked with debugger and found interesting thing that saving stops without going inside editOperation.Callback. I make testing project with Callback without any editing and get the same results. Have anyone run into the same situation? To check it you can use ProgressDialog sample from ArcGIS Pro SDK samples. Inside public static Task RunCancelableProgress(CancelableProgressorSource cps, uint howLongInSeconds) add call to my test function: System.Diagnostics.Debug.WriteLine(string.Format("RunCancelableProgress: Canceled {0}", cps.Progressor.CancellationToken.IsCancellationRequested)); TestEditOperation(); // My testing function }, cps.Progressor); My function code: private static void TestEditOperation() { try { string message = String.Empty; bool bResult = false; // Create a FileGeodatabaseConnectionPath using the path to the gdb. Note: This can be a path to a .sde file. FileGeodatabaseConnectionPath geodatabaseConnectionPath = new FileGeodatabaseConnectionPath(new Uri(@"C:\Temp\results.gdb")); // Create a new Geodatabase object using the FileGeodatabaseConnectionPath. using (Geodatabase geodatabase = new Geodatabase(geodatabaseConnectionPath)) { using (FeatureClass featClass = geodatabase.OpenDataset<FeatureClass>("Sites")) { EditOperation editOperation = new EditOperation(); editOperation.Callback(context => { try { FeatureClassDefinition fcDefinition = featClass.GetDefinition(); } catch (GeodatabaseException exObj) { message = exObj.Message; } }, featClass); bResult = editOperation.Execute(); if (!bResult) { message = editOperation.ErrorMessage; System.Diagnostics.Debug.WriteLine(message, System.Reflection.Assembly.GetExecutingAssembly().FullName); } else { var tsk = Project.Current.SaveEditsAsync(); tsk.Wait(); if (!tsk.Result) { message = "Saving results failed"; System.Diagnostics.Debug.WriteLine(message, System.Reflection.Assembly.GetExecutingAssembly().FullName); bResult = false; } } if (!string.IsNullOrEmpty(message)) { MessageBox.Show(message); } } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message, System.Reflection.Assembly.GetExecutingAssembly().FullName); throw; } }
... View more
07-24-2019
04:24 AM
|
0
|
0
|
1235
|
|
POST
|
Hi Kevin, Try this to get selected layers, then from layer you can get datasource and etc.: BasicFeatureLayer layer = null; await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { //find selected layer if (MapView.Active.GetSelectedLayers().Count == 0) { MessageBox.Show("Select a feature class from the Content 'Table of Content' first."); return; } layer = MapView.Active.GetSelectedLayers()[0] as BasicFeatureLayer; });
... View more
07-23-2019
11:00 PM
|
0
|
7
|
6558
|
|
POST
|
Hi Uma, I have changed color ramp to show that code does not work. I have used color ramp “Green Blues”. Below images before applying unique value colorizer and after Before: After: There is another one problem with unique value colorizer. My raster has two fields “Value” and “SLabel”(text). If I choose Field for colorizer “Value” I get no image on map at all. The color ramp is not what I choose too. Thanks Gintautas
... View more
07-22-2019
02:18 AM
|
0
|
7
|
8360
|
|
POST
|
Hi Uma, Thanks for reply. I have copied your code inside my test project. No changes. Result with your code Must be (result of the same color ramp from Symbology pane) When raster contains only one value (with your code):
... View more
07-18-2019
10:53 PM
|
0
|
9
|
8360
|
|
POST
|
Hi, I am trying to create raster layer from grid and apply unique value colorizer on the same button click. I have tried different techniques from samples with feature layers, from geonet question https://community.esri.com/thread/235510-applysymbologyfromlayer-geoprocessing-tool (part about Classify colorizer) but can't get results as I expected. Sometimes I see correct legend but no raster on map, otherwise bad legend and bad colorized raster on map. I modified ChangeColorizerForRasterLayer project from sdk samples to load my raster and added color ramp to SetToUniqueValueColorizer method. My code: public static async Task SetToUniqueValueColorizer(BasicRasterLayer basicRasterLayer) { // Creates a new UV Colorizer Definition using the default constructor. string fieldName = "Value"; string colorRampName = "Muted pastels"; string colorRampStyle = "ArcGIS Colors"; // Sets the newly created colorizer on the layer. await QueuedTask.Run(async() => { IList<ColorRampStyleItem> rampList = GetColorRampsFromStyleAsync(Project.Current, colorRampStyle, colorRampName); 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); }); } @Uma Harano could you please help me again. I can attach my raster.
... View more
07-16-2019
06:51 AM
|
0
|
13
|
10295
|
|
POST
|
Hi Evan, I store settings in library dll as singleton class with properties, but use them from more than 10 add-ins. Library dll added to GAC. Project settings form is stored in one of add-ins. That add-in manages loading and saving project properties from Project to singleton class and back. There is no cross-references between add-ins. There is only one thing you need to do that project settings add-in will be loaded first. More info here: https://www.esri.com/arcgis-blog/products/arcgis-pro/uncategorized/manage-arcgis-pro-add-in-loading/ In addition I use ( <modules><insertModule .... autoLoad="true">... ).
... View more
07-16-2019
06:33 AM
|
1
|
0
|
2494
|
|
POST
|
Hi Uma, Sorry, I have copied lyr file from old folder. There is one difference in our code: I create layer from scratch, you take layer from the map. Your code works in my testing button too. My code: RasterLayer rastLayer = (RasterLayer)LayerFactory.Instance.CreateLayer(new Uri(path), currentCont, -1, layerName); var lyrDocFromLyrxFile = new LayerDocument(sLyrPath); var cimLyrDoc = lyrDocFromLyrxFile.GetCIMLayerDocument(); //Get the renderer from the layer file var rendererFromLayerFile = ((CIMRasterLayer)cimLyrDoc.LayerDefinitions[0]).Colorizer; //Apply the renderer to the feature layer rastLayer?.SetColorizer(rendererFromLayerFile); currentCont - usually group layer Thanks
... View more
07-11-2019
11:18 PM
|
0
|
2
|
3682
|
|
POST
|
Hi Maxime, You can use event OnSaveEdits from IEditEvents2: http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#IEditEvents2_OnSaveEdits.htm Sample how to use events listening: https://github.com/Esri/arcobjects-sdk-community-samples/blob/master/Net/Controls/EditingEditEventListener
... View more
07-11-2019
04:10 AM
|
1
|
0
|
1404
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 04-24-2026 08:33 AM | |
| 1 | 03-23-2026 11:44 AM | |
| 1 | 05-22-2024 11:48 PM | |
| 1 | 02-27-2026 10:33 AM | |
| 1 | 01-07-2026 10:44 AM |
| Online Status |
Online
|
| Date Last Visited |
52m ago
|