POST
|
Adding raster imagery is no longer crashing the application, which is nice. Anyone figure out an effecient way to remove grouped layers?
... View more
11-13-2019
02:16 PM
|
0
|
0
|
246
|
POST
|
I am building an add-in to add/remove data from comboboxes and have encountered some issues. Background: I have a repository of .lyr files that point to source data (in all formats: raster, vector) in various locations (file gdb, sde), so I built a combobox for each category to display a list of the layer name: For the OnSelectionChange() I check if the layer selected exists by passing the selected "item.Text" as a key to a dictionary. If it does not exist, I return the path (its value) to a constructor so it is added to the active map and if it does exist, I want to remove the layer: protected async override void OnSelectionChange(ComboBoxItem item) { if (item == null) return; if (string.IsNullOrEmpty(item.Text)) return; var lyrExists = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Any(f => f.Name == item.Text); if (!lyrExists) { IDictionary<string, string> Planning_ = new Dictionary<string, string>(); Boundaries_.Add("94 Page Index btn8", @"\\Ceims\gd3\Layers\Boundaries\94 Page Index btn8.lyr"); Boundaries_.Add("94 Page Index", @"\\Ceims\gd3\Layers\Boundaries\94 Page Index.lyr"); Boundaries_.Add(rest of dictionary)... Map map = MapView.Active.Map; string pathkey = item.Text; string pathval = ""; if (Planning_.TryGetValue(pathkey, out pathval)) { string url = pathval; Uri uri = new Uri(url); await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer(uri, MapView.Active.Map)); } } else { var lyrExists = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(f => f.Name == item.Text); var lyrtoremove = lyrExists; // MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(f => f.Name == item.Text); await QueuedTask.Run(() => MapView.Active.Map.RemoveLayers(lyrtoremove)); }; In most cases the code works, yet I am having the following issues Adding raster imagery - I get a User-unhandled exception: (path to my .lyr file) cannot be used to create a layer. Layer type is not supported.' What command can I use to add raster data from an lyr file? When re-selecting a group layer I have added, another copy of the group layer is added instead of removed. Feature Layers work just fine, what is the best way to screen and remove group layers given this logic? If I am on the catalog pane and try to add a layer it crashes, do I need to set a state? Thanks in advance!
... View more
04-01-2019
12:22 PM
|
0
|
1
|
354
|
POST
|
Hi Uma, I can find the related code in MapControlDockpane.xaml.cs and understand the create method, but am stumped as to where I write the method with my parameters. Changing the MapControlContentFactory.Create method line to what you suggested results in errors that 'MapControlContent' does not contain a definition for 'create', so where do I put the definition block? Is that where the parameters are entered, or are they entered when I call the function? Thank you for your help with this!
... View more
11-02-2018
05:13 PM
|
0
|
1
|
693
|
POST
|
I have downloaded the community samples, installed SDK and run the solution successfully in Visual Studio to generate the default add-in. I am now interested in customizing the overviewmapcontrol to: 1) display specific layers (not all of the active/displayed layers) 2) open to a specified zoom extent and remain static unless the user clicks/pans/zooms the window pane I have located some of the snippets on the git site (zoom to extent specifically) but do not know how to format the coordinates and am unclear as to what heading they go under. I cannot find related code and am unfamiliar with coding in C# (pretty well versed in python and AHK). Any help or resources would be GREATLY appreciated.
... View more
10-31-2018
10:57 AM
|
0
|
3
|
832
|
POST
|
I can successfully rename the .tif files, but when I call CopyRaster_management I get an error that the input Raster doesn't exist or is not compatible. Is there an order of operations I am unaware of? Do the files need to be written to a folder after renaming them before moving them?
... View more
12-26-2017
03:34 PM
|
0
|
0
|
1279
|
POST
|
I tried it without an extension, I realize above it should be "newFile"+.tif, but it is not working
... View more
12-15-2017
02:07 PM
|
0
|
2
|
1279
|
POST
|
Getting an error now when calling the module. Runtime error Traceback (most recent call last): File "<string>", line 43, in <module> File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 12583, in CopyRaster raise e ExecuteError: ERROR 000732: Input Raster: Dataset newFile does not exist or is not supported filCnt = 0 for file in files: # Slice off 1st 4 digits of file name num = file[0:4] if num == "1982": filCnt = filCnt + 1 sStg = 0 sStg = file.find('L') # A few files contain L if sStg > 8 and sStg < 15: newFile = file[sStg+2:] arcpy.CopyRaster_management("newFile+.tif", "outDir", "DEFAULTS" , "" , "" , "" , "" , "") print "Processing..." +newFile sStg = file.find('l') # A few files contain l if sStg > 8 and sStg < 15: newFile = file[sStg+2:] arcpy.CopyRaster_management("newFile+.tif", "outDir", "DEFAULTS" , "" , "" , "" , "" , "") print "Processing..." +newFile What do I need to do here??
... View more
12-15-2017
02:04 PM
|
0
|
3
|
1279
|
POST
|
Thanks Jake, what is the best order of operations to achieve this? Can I call the tool on the same line as the shutil.copy command? Or, do I need another block?
... View more
12-15-2017
12:28 PM
|
0
|
5
|
1279
|
POST
|
I am working on a script to rename and copy a large raster data set, in folders containing .prj, .tfwx, .tif.aux.xml, .ovr, and .tif.xml files with each .tif image. In running a simple rename and shutil.copy script (below) I lose parts of the metadata: ... filCnt = 0 for file in files: # Slice off 1st 4 digits of file name num = file[0:4] if num == "1982": filCnt = filCnt + 1 sStg = 0 sStg = file.find('L') # A few files contain L if sStg > 8 and sStg < 15: newFile = file[sStg+2:] shutil.copy(file,outDir+newFile) print newFile sStg = file.find('l') # A few files contain l if sStg > 8 and sStg < 15: newFile = file[sStg+2:] shutil.copy(file,outDir+newFile) print newFile How can I modify this to keep the renaming convention, but use another copying procedure? The Copy Raster tool ignores the associated files and I would prefer not creating a database for this, given the amount of data. Any ideas? Thank you! Running 10.3 btw
... View more
12-15-2017
11:57 AM
|
0
|
8
|
2452
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|