POST
|
Colin, Funnily it seems that it was the missing QueuedTask.Run that produced the null RowCursor. I didn't use it because the ProConcepts Geodatabase · Esri/arcgis-pro-sdk Wiki · GitHub page says "you can create a QueryFilter on a non-MCT thread". (a concept I don't fully understand yet). Many thanks, Andres
... View more
07-18-2017
07:16 AM
|
0
|
0
|
1457
|
POST
|
Thank you Colin, First this happens: private async Task AddLayerToMap(string layerPath, string layerField, string layerFileName) { try { // Get the first map called "Map" from the current project. Map myMap = null; myMap = await GetMapFromProject(Project.Current, "Map"); if (myMap == null) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to get map."); return; } await QueuedTask.Run(() => { SelectedLayer = MapView.Active.Map.FindLayers(layerFileName, true).FirstOrDefault() as FeatureLayer; if (SelectedLayer == null) { SelectedLayer = LayerFactory.CreateFeatureLayer(new Uri(layerPath), myMap); } MapView.Active.ZoomToAsync(SelectedLayer); if (SelectedLayer == null) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to create layer for url:" + layerPath); return; } else { var queryFilter = new QueryFilter(); queryFilter.PostfixClause = "ORDER BY " + layerField; var rc = SelectedLayer.Search(queryFilter); FieldList.Clear(); while (rc.MoveNext()) { using (Feature feature = (Feature)rc.Current) { string name = Convert.ToString(feature[layerField]); FieldList.Add(name); } } } }); } catch (Exception exc) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Exception caught: " + exc.Message); return; } FieldListBox.Items.Clear(); foreach (string ListItem in FieldList) { FieldListBox.Items.Add(ListItem); } } Then this: void NameFilterBox_KeyUp(object sender, KeyEventArgs e) { TextBox source = e.Source as TextBox; NamePart = source.Text; QueryFilter queryFilter = new QueryFilter(); if (NamePart == "") { queryFilter.WhereClause = ""; } else { queryFilter.WhereClause = layerField + " LIKE '%" + NamePart + "%'"; } queryFilter.PostfixClause = "ORDER BY " + layerField; RowCursor rc = SelectedLayer.Search(queryFilter); // <- returns null !!! //Create list of oids to update while (rc.MoveNext()) { using (Feature feature = (Feature)rc.Current) { string name = Convert.ToString(feature[layerField]); FieldList.Add(name); } } }
... View more
07-17-2017
12:11 PM
|
0
|
2
|
1457
|
POST
|
I'm using a QueryFilter.Search to populate a ListBox with the name of all the records. Once all the records are shown, I want to be able to allow a user to filter them according to a string of characters. For this I'm creating a new QueryFilter in which the WhereClause is "FIELD LIKE '%" + NamePart + "%'". However I can't figure out why this new QueryFilter doesn't work even with no WhereClause. Does some one know why? Should the new search be "reset" in some way?
... View more
07-11-2017
11:06 AM
|
0
|
5
|
2228
|
POST
|
Thank you Charles. Yes, myMap is the MapView.Active.Map and RefLayer.Name is the layerName. Your questions helped me find out what the problem was: I was handling the creation in a queued task and FindLayers outside that task. I'm new to C# so I haven't really grasped how the queued tasks work. Thanks again!
... View more
06-23-2017
07:30 AM
|
0
|
0
|
435
|
POST
|
Hi, I am adding a layer to a map and want to read all the values from a particular field, await QueuedTask.Run(() => { Layer RefLayer = LayerFactory.CreateLayer(new Uri(LyrFile), myMap); MapView.Active.ZoomToAsync(RefLayer); if (RefLayer == null) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to create layer for url:" + LyrFile); return; } else { //find layer var disLayer = MapView.Active.Map.FindLayers(layerName).FirstOrDefault() as BasicFeatureLayer; } }); however the FindLayers returns null. What would be an appropriate way to wait until the creation is done? Can someone help me solve this?
... View more
06-22-2017
02:09 PM
|
0
|
2
|
767
|
POST
|
Hi, I am adding a layer to a map and want to read all the values from a particular field, await QueuedTask.Run(() => { Layer RefLayer = LayerFactory.CreateLayer(new Uri(LyrFile), myMap); MapView.Active.ZoomToAsync(RefLayer); if (RefLayer == null) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to create layer for url:" + LyrFile); return; } else { //find layer var disLayer = MapView.Active.Map.FindLayers(layerName).FirstOrDefault() as BasicFeatureLayer; } }); however the FindLayers returns null. What would be an appropriate way to wait until the creation is done? Can someone help me solve this?
... View more
06-22-2017
01:43 PM
|
0
|
0
|
376
|
POST
|
What is theMapPoint? Is it a point selected from the map? If so, that's not what I need. I need a way to convert geographic coordinates into MapPoints.
... View more
01-23-2017
01:40 PM
|
0
|
0
|
1266
|
POST
|
I am creating a tool that would zoom in on specific geographic points. My idea is to have the list of geographic points with their geographic coordinates which the tool should convert to the current map mappoints, but as said I'm a bit clueless on how to go about.
... View more
01-23-2017
12:33 PM
|
0
|
0
|
1266
|
POST
|
Hello, I'm trying to locate on the map a geographic coordinate. I haven't been able to find a ProSnippet, arcgis pro sdk community samples or any other example that can give me clues on how to do it.#arcgisprosdk #csharp #addin #coordinate #mappoint
... View more
01-23-2017
10:57 AM
|
0
|
5
|
1842
|
POST
|
I need to populate a ComboBox according to the selection of a first ComboBox. What is the best way to pass the selected value to the second ComboBox? Thanks arcgisprosdk #combobox selected value #csharp #addin
... View more
01-18-2017
07:09 AM
|
0
|
0
|
1340
|
POST
|
Thank you Charles, but neither is what I'm looking for. I want the text file to be external to the Addin so that the lines (each line is an item) can be edited (customized) by each Addin user. The users won't have Visual Studio to access and edit any embedded resource. The "Access Content" link you sent me has a similar concept to what I want which is to get the path where the Addin is located in run time that would then be useful to access the Addin accompanying text file. However it is reading the assembly path and not the actual location of the distributed Addin.
... View more
12-30-2016
01:33 PM
|
0
|
1
|
465
|
POST
|
Hello, I'm reading a text file to populate a combo box so that its items can be easily modified. Which is the default location for such a file if for example I use: new System.IO.StreamReader("myaddin.txt"); ? I've tried putting the text file in the same folder where the myaddin.esriAddInX is (which would be my preferred location) with no success. Where can I have an explanation on what is the process that add-ins go through to search for a file? #arcgisprosdk #addin #c sharp
... View more
12-30-2016
11:27 AM
|
0
|
3
|
1628
|
POST
|
Thank you Wolfgang. I checked your code and the WorkingWithDALM example, but both are different cases to what I'm trying to do. I'm using: ... </controls> </insertModule> <updateModule refID="MyAddin1_Module"> <tabs> <updateTab refID="MyAddins_Tab"> <updateGroup refID="Layer_Group"></updateGroup> </updateTab> </tabs> </updateModule> </modules> </ArcGIS> to try to have a second button within the same group of the first app. I made sure both were working and that the first one loads first. The second Add-in has the same module, tab and group id as the first one. What is wrong here? Is there a reference document on the config.daml file?
... View more
12-28-2016
01:20 PM
|
0
|
1
|
1353
|
POST
|
I'm creating a series of Add-ins to place on my own custom ribbon tab. Only the first Add-in is showing up on my tab. A second one, created as an independent project, doesn't work despite having the same (or different) module id, module classname and tab id. What are the requirements to put different independent Add-ins on the same custom tab? Do they have to be created in the same solution? #arcgisprosdk #creating .net add-ins
... View more
12-28-2016
08:38 AM
|
0
|
4
|
2758
|
POST
|
That's very kind of you Charles. Right after posting this, I realized how foolish the question is and would have deleted it if I could. I was using a very long UNC path and made a mistake typing it.
... View more
12-21-2016
12:19 PM
|
0
|
0
|
327
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|