|
POST
|
Hi John, If you do not use MVVM then you could add event to your xaml file like this: <ComboBox x:Name="cbLayer" Margin="10" Width="150" SelectionChanged="Layer_SelectionChanged"> In xaml.cs you need to add method for SelectionChanged: private void Layer_SelectionChanged(object sender, SelectionChangedEventArgs e) In MVVM you do not need OnSelectionChange. You need to create property for SelectedItem or SelectedValue in your model view file and make binding in xaml <ComboBox ItemsSource="{Binding Layers}" SelectedItem="{Binding SelectedLayer}"/>
... View more
06-03-2019
11:23 PM
|
1
|
1
|
1936
|
|
POST
|
Hi, Sorry. I have combined code in notepad. Instead of featureClass you need to use firstLayer. I send you update peace of code: var firstLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(); var selectionfromMap = firstLayer.GetSelection(); ArcGIS.Core.Data.QueryFilter filter = new ArcGIS.Core.Data.QueryFilter { ObjectIDs = selectionfromMap.GetObjectIDs() }; // get the row using (ArcGIS.Core.Data.RowCursor rowCursor = firstLayer.Search(filter)) { while (rowCursor.MoveNext()) { long oid = rowCursor.Current.GetObjectID(); // get the shape from the row ArcGIS.Core.Data.Feature feature = rowCursor.Current as ArcGIS.Core.Data.Feature; Polygon polygon = feature.GetShape() as Polygon; // do something here }
... View more
05-29-2019
11:48 PM
|
3
|
1
|
3831
|
|
POST
|
Hi Jaewon, This is code combined from few ArcGIS Pro snippets: var firstLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(); var selectionfromMap = firstLayer.GetSelection(); ArcGIS.Core.Data.QueryFilter filter = new ArcGIS.Core.Data.QueryFilter { ObjectIDs= selectionfromMap.GetObjectIDs(); }; // get the row using (ArcGIS.Core.Data.RowCursor rowCursor = featureClass.Search(filter, false)) { while (rowCursor.MoveNext()) { long oid = rowCursor.Current.GetObjectID(); // get the shape from the row ArcGIS.Core.Data.Feature feature = rowCursor.Current as ArcGIS.Core.Data.Feature; Polygon polygon = feature.GetShape() as Polygon; // get the attribute from the row (assume it's a double field) double value = (double)rowCursor.Current.GetOriginalValue(fldIndex); // do something here } }
... View more
05-29-2019
11:24 PM
|
2
|
3
|
3831
|
|
POST
|
Hi Dylan, Sorry. I have replied from the mail and some part of my answer missed. I wanted to write what Dictionary is better than List in your case. For example if you need few fields from one layer, you can build dictionary like this: Dictionary<string, List<string>>, where first is layer name, second one is list of field names. So you will need less stuff to get the same results. I would code in different way case than one layer has few fields. I would read all values in one RowCursor. It will be faster. My GetAttributeValues procedure would have List<string> fieldNames parameter instead of string fieldName and return type will be List<string> for each of attribute fields. Then I don't need to check fields number, have 2 branches in my code and etc.
... View more
05-15-2019
10:43 PM
|
0
|
1
|
14124
|
|
POST
|
Hi Dharma, If you mean GeoProcessor using, then before calling Execute method you can set environment variables using SetEnvironmentValue method. Sample here: https://idea.isnew.info/how-to-use-the-geoprocessor-using-arcobjects.html
... View more
05-15-2019
02:34 AM
|
0
|
1
|
1447
|
|
POST
|
Hi Dylan, At first instead of List kvp in features) { string fieldName; if(list.TryGetValue(kvp.Key.Name, out fieldName)) { long fCnt = kvp.Value.Count; total = total + fCnt; sb.AppendLine($@"{fCnt} {(fCnt == 1 ? "record" : "records")} selected for {kvp.Key.Name}"); QueryFilter queryFilter = new QueryFilter { ObjectIDs = kvp.Value }; using (RowCursor rowCursor = kvp.Key.Search(queryFilter)) { while (rowCursor.MoveNext()) { using (Row row = rowCursor.Current) { string attributeValue = Convert.ToString(row[fieldName]); // Do something with attribute value } } } } }
... View more
05-15-2019
02:16 AM
|
1
|
1
|
14124
|
|
POST
|
Hi Nirbhay, Look at the content of link: https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Configurations
... View more
05-14-2019
06:28 AM
|
0
|
0
|
618
|
|
POST
|
Hi Khamille, Try to look at this link: https://community.esri.com/thread/210462-programmatically-start-the-edit-annotation-tool-in-modify-features
... View more
05-13-2019
10:42 PM
|
0
|
0
|
1580
|
|
POST
|
Hi Tim, You can use Inspector (for one by one feature) // for each feature foreach (var oid in featOids) { // load the inspector with the feature var insp = new Inspector(); insp.Load(faetLayer, oid); .... } or use query like this: QueryFilter queryFilter = new QueryFilter { ObjectIDs = oids }; using (RowCursor rowCursor = featLayer.Search(queryFilter)) { while (rowCursor.MoveNext()) { using (Row row = rowCursor.Current) { Feature feat = row as Feature; .... } } }
... View more
05-12-2019
10:54 PM
|
3
|
0
|
14124
|
|
POST
|
Hi Brian, I use Execute for custom Commands and CurrentTool method from IApplication for custom Tools. They work a little bit different.
... View more
05-09-2019
06:54 AM
|
0
|
3
|
1322
|
|
POST
|
Hi Dharma, “C:\Program Files\Common Files\ArcGIS\bin\ESRIRegAsm.exe” “.dll” /p:desktop
... View more
05-08-2019
02:48 AM
|
2
|
0
|
1481
|
|
POST
|
HI Dharma, Have you registered for ArcMap your library with dockable window on another machine? Compiler registers your library on your machine automatically.
... View more
05-06-2019
11:45 PM
|
0
|
2
|
1481
|
|
POST
|
Hi Mark, We use IGdbXmlImport and IGdbXmlExport for schema importing/exporting. But we work with personal or file geodatabases. I have not tried to use them on enterprise database. It could be some problems if your database contains Schematic stuff. http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#Export_datasets_to_an_xml_workspace_document_2.htm
... View more
05-06-2019
01:39 AM
|
1
|
1
|
2640
|
|
POST
|
Hi, Open Reference folder of your project in Solution Explorer. Select all ArcGIS references. Right click on them and select Properties. .Net frame version depends on your lowest ArcGIS version. It can’t be higher than your lowest ArcGIS version supports. For example: • ArcGIS 10.0 - .NET Framework 3.5 SP1 • ArcGIS 10.1 - .NET Framework 3.5 SP1 • ArcGIS 10.2 - .NET Framework 3.5 SP1 • ArcGIS 10.3 - .NET Framework 3.5 SP1 • ArcGIS 10.4 - .NET Framework 4.5 SP1 • ArcGIS 10.5 - .NET Framework 4.5 SP1 • ArcGIS 10.6 - .NET Framework 4.5 SP1 • ArcGIS 10.7 - .NET Framework 4.5 SP1
... View more
04-29-2019
02:44 AM
|
2
|
2
|
2288
|
| 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 |
Offline
|
| Date Last Visited |
Wednesday
|