|
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
|
10754
|
|
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
|
2575
|
|
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
|
3886
|
|
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
|
1454
|
|
POST
|
Hi Rich, Thank you for information about the plans. My code works as I need for now.
... View more
07-10-2019
10:48 PM
|
0
|
1
|
2563
|
|
POST
|
Hi Rich, I think I found solution, but I don't know if it is the best. The way of enumerating I described in previous reply. This is code of my solution: // Add a folder to the Project var folderToAdd = ItemFactory.Instance.Create(sResultsPath); await QueuedTask.Run(() => Project.Current.AddItem(folderToAdd as IProjectItem)); // find the folder project item FolderConnectionProjectItem folder = Project.Current.GetItems<FolderConnectionProjectItem>().FirstOrDefault(f => f.Path.Equals(sResultsPath, StringComparison.CurrentCultureIgnoreCase)); if (folder == null) return; // do the search IEnumerable<Item> folderFiles = null; await QueuedTask.Run(() => folderFiles = folder.GetItems().Where(f => f.Type == "Raster Dataset")); foreach (Item item in folderFiles) { System.Diagnostics.Debug.WriteLine(item.ToString()); }
... View more
07-09-2019
11:19 PM
|
1
|
3
|
2563
|
|
POST
|
Hi Uma, I have tried your snippet on grid rasters. I can send you grid and lyrx if you need.
... View more
07-09-2019
10:54 PM
|
0
|
6
|
3886
|
|
POST
|
Hi Rich, I am starting from folder path on disk. ArcMap application creates rasters and I use ArcGIS Pro to visualize them. I have tried to create a new FileSystemDatastore using the FileSystemConnectionPath, but compiler can’t cast FileSystemDatastore to Geodatabase. I think that I must add my folder to Project first ant then get back from Project my folder as FolderConnectionProjectItem. Then use GetItems from FolderConnectionProjectItem to get my rasters and etc. I will try to do that.
... View more
07-09-2019
08:29 AM
|
0
|
0
|
2563
|
|
POST
|
Hi, I would like to enumerate raster datasets in folder where other process created them. Something like in ArcObjects: pDatasets = pWorkspace.get_Datasets(esriDatasetType.esriDTRasterDataset); I have found information about GetItems here: https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Content-and-Items#items-and-factories But I do not know how to get starting item from my folder path, what factory and what item to use.
... View more
07-09-2019
08:06 AM
|
0
|
6
|
2644
|
|
POST
|
Hi Uma, Thanks for reply. Your snippet doesn’t work with old lyr files (crashes with HResult=0x80004005 Message=Could not determine encoding). It does not work with “Classify“ colorizer in lyrx file too. The only way what works is loading lyr(x) file and updating data source. But there are other problems with locking as I mentioned earlier.
... View more
07-09-2019
01:11 AM
|
0
|
0
|
3232
|
|
POST
|
Hi Uma, What about the same functionality for raster layers? I have installed 2.4 and found that RasterLayer does not have SetRenderer method. My workarounds some how lock my data and I can't run calculations on the same database on ArcMap. The place that locks my database is creating raster layer with symbology.
... View more
07-04-2019
06:49 AM
|
0
|
2
|
3232
|
|
POST
|
Hi, Have you seen that kind arrangement on ArcGIS Pro?
... View more
07-01-2019
02:36 AM
|
0
|
1
|
2129
|
|
POST
|
Hi Dylan, You need to change attribute checkForUpdatesAtStartup value to true in config.daml file: <Configuration blockCustomizeDialog="false" blockPerfMeter="true" checkForUpdatesAtStartup="true"> <ConfigurationManager className="ConfigurationManager1"/> </Configuration> By default it is false. More info here: https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Configurations I have checked in my configuration project and it works. Maybe you need to set other two attributes from my code. I have just copied all attributes to my config.daml
... View more
07-01-2019
01:17 AM
|
1
|
0
|
2414
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 1 | 2 weeks ago | |
| 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 |
a week ago
|