|
POST
|
Check this if helps any https://support.esri.com/en/technical-article/000012642
... View more
12-29-2020
09:47 AM
|
1
|
1
|
13109
|
|
POST
|
I was able to use multiple criteria when setting definition by using AND instead of &&. //Make sure to insert spaces before and after " AND "
string dq = $@"FEATURE_CLASS = '{Feature}'" + " AND " + $@"STATE_ALPHA = '{State}'"
GNISFLayer.SetDefinitionQuery(dq) Then, I came up with this solution: public Task<Dictionary<QueryFilter, string[]>> UpdateSelection()
{
return QueuedTask.Run(() =>
{
if (_tableContent != null)
{
string GNISFType = $@"FEATURE_CLASS = '{Feature}'";
string GNISState = $@"STATE_ALPHA = '{State}'";
string GNISCounty = $@"COUNTY_NAME = '{County}'";
string GNISQuad = $@"MAP_NAME = '{Quad}'";
string[] GNISFTypeArr = { GNISFType, Feature };
string[] GNISStateArr = { GNISState, State };
string[] GNISCountyArr = { GNISCounty, County };
string[] GNISQuadArr = { GNISQuad, Quad };
QueryFilter qfFType = new QueryFilter { WhereClause = GNISFType };
QueryFilter qfState = new QueryFilter { WhereClause = GNISState };
QueryFilter qfCounty = new QueryFilter { WhereClause = GNISCounty };
QueryFilter qfQuad = new QueryFilter { WhereClause = GNISQuad };
FieldFilterDic = new Dictionary<QueryFilter, string[]>
{
{ qfFType, GNISFTypeArr},
{ qfState, GNISStateArr},
{ qfCounty, GNISCountyArr},
{ qfQuad, GNISQuadArr}
};
if (Feature == "All")
FieldFilterDic.Remove(qfFType);
if (State == "All")
FieldFilterDic.Remove(qfState);
if (County == "All")
FieldFilterDic.Remove(qfCounty);
if (Quad == "All")
FieldFilterDic.Remove(qfQuad);
if (FieldFilterDic.Count > 0)
{
foreach (KeyValuePair<QueryFilter, string[]> kvp in FieldFilterDic)
{
if ( kvp.Key == FieldFilterDic.Keys.First())
GNISFLayer.Select(kvp.Key, SelectionCombinationMethod.New);
else
GNISFLayer.Select(kvp.Key, SelectionCombinationMethod.And);
}
}
else
GNISFLayer.ClearSelection();
}
return FieldFilterDic;
});
}
private void DisplaySelBoolChanged()
{
if (DisplaySelBool)
{
QueuedTask.Run(() =>
{
if (SelectionDict.Count > 0)
{
GNISFLayer.RemoveAllDefinitionFilters();
string entireExp = null;
if (SelectionDict.Count > 0)
{
foreach (KeyValuePair<QueryFilter, string[]> kvp in FieldFilterDic)
{
if (kvp.Key == SelectionDict.Keys.Last())
entireExp += kvp.Value[0];
else
entireExp += kvp.Value[0] + " AND ";
}
}
MessageBox.Show(entireExp);
GNISFLayer.SetDefinitionQuery(entireExp);
}
else
{
GNISFLayer.RemoveAllDefinitionFilters();
DisplaySelBool = false;
}
});
}
//else
// GNISFLayer.RemoveAllDefinitionFilters();
} first method (UpdateSelection()) use the dictionary and return it to the main thread and the same dictionary is used for setting up/impementing the Definition Filter in the DisplaySelBoolChanged() method private async void FeatureTypeSelectionChanged()
{
var resultDic = await UpdateSelection();
SelectionDict = resultDic;
DisplaySelBoolChanged();
}
... View more
12-28-2020
02:09 PM
|
0
|
0
|
2077
|
|
POST
|
I have created a table view which users can filter features by making selection via multiple combo boxes public void UpdateSelection()
{
QueuedTask.Run(() =>
{
if (_tableContent != null)
{
QueryFilter qfFType = new QueryFilter { WhereClause =
$@"FEATURE_CLASS = '{Feature}'" };
QueryFilter qfState = new QueryFilter { WhereClause =
$@"STATE_ALPHA = '{State}'" };
QueryFilter qfCounty = new QueryFilter { WhereClause =
$@"COUNTY_NAME = '{County}'" };
QueryFilter qfQuad = new QueryFilter { WhereClause =
$@"MAP_NAME = '{Quad}'" };
Dictionary<QueryFilter, string> FieldFilterDic = new
Dictionary<QueryFilter, string>
{
{ qfFType, Feature},
{ qfState, State },
{ qfCounty, County},
{ qfQuad, Quad}
};
if (Feature == "All")
FieldFilterDic.Remove(qfFType);
if (State == "All")
FieldFilterDic.Remove(qfState);
if (County == "All")
FieldFilterDic.Remove(qfCounty);
if (Quad == "All")
FieldFilterDic.Remove(qfQuad);
if (FieldFilterDic.Count > 0)
{
var firstFilter = FieldFilterDic.Keys.First();
var firststring = FieldFilterDic[firstFilter];
GNISFLayer.Select(firstFilter,
SelectionCombinationMethod.New);
FieldFilterDic.Remove(firstFilter);
foreach (KeyValuePair<QueryFilter, string> kvp in FieldFilterDic)
{
GNISFLayer.Select(kvp.Key,
SelectionCombinationMethod.And);
}
}
else
GNISFLayer.ClearSelection();
}
});
} The method above works fine for selecting features based on multiple criteria taken from combo boxes. I would also like to remove features from the display as user filters out the features. I think I can adapt the syncing myself as far as if I can use multiple criteria on the Definition Query. For instance, something like Definition Query = GNISFLayer.SetDefinitionQuery($@"FEATURE_CLASS = '{Feature}' && $@"STATE_ALPHA = '{State}'"");
... View more
12-28-2020
11:47 AM
|
0
|
1
|
2142
|
|
POST
|
Thank you @Wolf , I deleted all add-ins inside C:\Users\user_name\Documents\ArcGIS\AddIns\ArcGISPro but they error still shows up. Would you please give me an example of ItemTemplate ? I might be having having problem of not following MVVM model also. I am using Code-behind to update controls.
... View more
12-04-2020
11:31 AM
|
0
|
0
|
3454
|
|
POST
|
I started to develop a new module and able to fire up my first binding instead of accessing from Dockpane.xaml.cs. I used the initialization event because I was trying to make a list box's items source ready when Dockpane started even before a user interact with the dockpane. I read the items from a CVS file and add to an Observable collection for the list box. I am sure there is a MVVM way to do this. Thanks again for all your help.
... View more
12-03-2020
05:48 AM
|
0
|
1
|
7464
|
|
POST
|
Finally, I am beginning to digest MVVM for ArcGIS Pro framework. I think I checked too many examples so MVVM it got confusing. I thought It was so easy to use controls from Dockpane.xaml.cs. I guess also Visual Studio is not designed for MVVM well. I can create an event name on Properties Window for a control. Its method shows up in Dockpane.xaml.cs. Dockpane.xaml <ListBox x:Name="CountiesListBox" Width="100" Height="200" Margin="0" HorizontalAlignment="Left" Initialized="ListBox_Initialized" Dockpane.xaml.cs private void ListBox_Initialized(object sender, EventArgs e)
{
// (Inner voice) Should I do something here?
} Anyway, thanks a lot for your patience and being responsive. It is what is.
... View more
12-02-2020
09:07 AM
|
0
|
3
|
7468
|
|
POST
|
@GKmieliauskas Thank you for your answer. I already saw many examples and read some articles about MVVM but I still have not understood completely. As you said I name the controls via "x:Name" and access them through Dockpane.xaml.cs (I just figured out that this file also part of the view in MVVM) and I know how controls work. I already built a functional dockpane but I would like to organize it in a proper MVVM pattern. Dockpane.xaml and Dockpane.xaml.cs both comprise View in MVVM? Dockpane.xaml takes care of Visual elements in UI whereas Dockpane.xaml.cs takes care of events user clicks/selections, initializations etc. DockpaneViewModel.cs binds sources to the view. For example, an observable collection points to a listbox as items source. If I need to do any changes on the observable collection, I should do it in DockpaneViewModel.cs, right? Now, why I need a model then and which one is model file or class in a dockpane module?
... View more
12-01-2020
12:50 PM
|
0
|
5
|
7483
|
|
POST
|
Ok, inside which file I will create private and public headings (Heading and _heading) and how I will access to those headings from the model (Dockpane.xaml.cs) to modify a tab's heading property?
... View more
12-01-2020
09:37 AM
|
0
|
7
|
7489
|
|
POST
|
I created a ProModule with SDK I get this error as soon as AGP started via Visual Studio I removed the add-in and created an empty module I still get this binding failure. Do you have any idea what is going on?
... View more
11-29-2020
08:58 AM
|
0
|
6
|
3534
|
|
POST
|
There is a tool to calculate surface volume https://pro.arcgis.com/en/pro-app/tool-reference/3d-analyst/surface-volume.htm A similar tool is also available in ArcMap https://desktop.arcgis.com/en/arcmap/10.3/tools/3d-analyst-toolbox/surface-volume.htm You don't need any coding experience just find the tool and use your DEM as your elevation surface. You can calculate 2D, 3D area, volumes for different elevations levels and see which one is more. I think that is what you looking for.
... View more
11-28-2020
09:09 AM
|
0
|
0
|
2425
|
|
POST
|
You can read min values from the each raster and add to a list, then write into an excel file. You might need to download xlswriter library or write into .dbf file and convert to excel file. There are multiple ways writing from list to excel file import arcpy import os import xlsxwriter raster_list = os.listdir(path/to/rasterfolder) value_list = [] for each_raster in raster_list: result = arcpy.GetRasterProperties_management(each_raster, "MINIMUM") min_value = result.getOutput(0) value_list.add(min_value) with xlsxwriter.Workbook('RasterValues.xlsx') as workbook: worksheet = workbook.add_worksheet() for row_num, data in enumerate(value_list): worksheet.write_row(row_num, 0, data)
... View more
11-28-2020
08:31 AM
|
0
|
1
|
4483
|
|
POST
|
The idea was zooming to selected feature when user selects it via a listbox. I knew I was doing something wrong with the whereclause so it worked when I changed the code as string selectedCounty = CountiesListBox.SelectedItem.ToString();
QueuedTask.Run(() =>
{
FeatureLayer featLayer = countiesLayer as FeatureLayer;
QueryFilter qf = new QueryFilter { WhereClause = $@"myFieldName =
'{selectedCounty}'" };
qf.WhereClause = selectedCounty;
featLayer.Select(qf);
MapView.Active.ZoomToSelected();
}); Thanks @Anonymous User
... View more
11-23-2020
01:51 PM
|
0
|
0
|
4280
|
|
POST
|
I am trying to zoom to a selected feature on a feature layer. I have found some answers here but I was not able to adapt any of them into my situation. Related answers: https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-select-feature-from-featurelayer/m-p/866907#M4984 https://community.esri.com/t5/arcgis-runtime-sdk-for-net/arcgis-runtime-sdk-for-net-zoom-to-features-that-are-not/m-p/426725#M5169 https://community.esri.com/t5/arcgis-pro-sdk-questions/pro-sdk-how-to-get-features-after-getfeatures/td-p/766418 string selectedCounty = CountiesListBox.SelectedItem.ToString();
QueuedTask.Run(() =>
{
FeatureLayer featLayer = countiesLayer as FeatureLayer;
QueryFilter qf = new QueryFilter { SubFields = "NAME2" };
qf.WhereClause = selectedCounty;
featLayer.Select(qf);
MapView.Active.ZoomToSelected();
}); I think I have syntax problem somewhere. If I remove qf I am able to select everything.
... View more
11-23-2020
01:05 PM
|
0
|
2
|
4299
|
|
POST
|
Thank you @GKmieliauskas I will check it out As soon as I get time.
... View more
11-16-2020
07:17 PM
|
0
|
0
|
7524
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-23-2021 02:29 PM | |
| 1 | 09-25-2024 03:31 PM | |
| 1 | 02-26-2024 06:48 AM | |
| 1 | 02-11-2020 02:18 PM | |
| 1 | 07-20-2022 08:51 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|