|
POST
|
Hi Andrea, There is no direct way to do this. The best solution at this point is to create a temporary table from your selection using geoprocessing tools and use that to run Table.CalculateStatistics(). --Rich
... View more
08-21-2018
11:38 AM
|
0
|
0
|
709
|
|
POST
|
To answer Mike's original question, I've expanded the snippet he posted to extract the calculation results. Here is the code: // Calculate Statistics IReadOnlyList<TableStatisticsResult> tableStatisticsResults = countryFeatureClass.CalculateStatistics(tableStatisticsDescription); foreach(TableStatisticsResult tableStatisticsResult in tableStatisticsResults) { // Get the Region name // If multiple fields had been passed into TableStatisticsDescription.GroupBy, there // would be multiple values in TableStatisticsResult.GroupBy string regionName = tableStatisticsResult.GroupBy.First().Value.ToString(); // Get the statistics results for the Population_1990 field StatisticsResult pop1990Statistics = tableStatisticsResult.StatisticsResults[0]; double population1990Sum = pop1990Statistics.Sum; double population1990Average = pop1990Statistics.Average; // Get the statistics results for the Population_2000 field StatisticsResult pop2000Statistics = tableStatisticsResult.StatisticsResults[1]; double population2000Sum = pop2000Statistics.Sum; double population2000Average = pop2000Statistics.Average; // Do something with the results here... } I hope this helps.
... View more
07-23-2018
11:33 AM
|
2
|
1
|
3078
|
|
POST
|
Hi Luke, Yes, it is possible to get the unique values of a field, but the way to do so isn't obvious. As Colin pointed out, the key is to use the Table.CalculateStatistics() routine. This will allow you to generate statistics on one or more fields and includes the ability to execute a group by on these statistics. To get the unique values, you execute this code, passing in a "dummy" statistic to calculate. In the example below, I build a list of unique values for the SUB_REGION field of a States table. // Get field for Region Field regionField = featureClassDefinition.GetFields().First(x => x.Name.Equals("SUB_REGION")); // Create a "fake" StatisticsDescription object StatisticsDescription statisticsDescription = new StatisticsDescription(regionField, new List<StatisticsFunction>() { StatisticsFunction.Count }); // Create a TableStatisticsDescription that will return unique Region values (and a // count of how many rows have that value) TableStatisticsDescription tableStatisticsDescription = new TableStatisticsDescription(new List<StatisticsDescription>() { statisticsDescription }); tableStatisticsDescription.GroupBy = new List<Field>(){ regionField }; // Generate the statistics (and list of unique values) IReadOnlyList<TableStatisticsResult> results = statesFeatureClass.CalculateStatistics(tableStatisticsDescription); // Table.CalculateStatistics() returns one TableStatisticsResult object for each unique // GroupBy tuple. // If you pass one field into the TableStatisticsDescription.GroupBy object, you'll get // one TableStatisticsResult object for each unique value of that field foreach(TableStatisticsResult result in results) { // TableStatisticsResult.GroupBy returns one KeyValuePair<Field,object> for each field // in the TableStatisticsDescription.GroupBy list // If you only pass one field into that list, we only get one // KeyValuePair<Field,object> KeyValuePair<Field, object> groupByPair = result.GroupBy.First(); // groupByPair.Field is the Field you passed into TableStatisticsDescription.GroupBy // groupByPair.Value is a unique value of that field string myFieldValue = (string) groupByPair.Value; Console.WriteLine(myFieldValue); } We'll take a look at providing a more obvious way this to do in a future version of ArcGIS Pro. Let me know if this helps, --Rich
... View more
07-23-2018
10:49 AM
|
1
|
1
|
2873
|
|
POST
|
Charles, The API reference is here: http://prodev.arcgis.com/en/pro-app/sdk/api-reference/#topic20822.html Can you share more about what isn't working? Thanks, --Rich
... View more
07-18-2018
12:13 PM
|
0
|
0
|
5266
|
|
POST
|
Brian, We've confirmed this as a bug in Pro 2.2. The problem occurs when you first open the Domains window and then try to scroll the subtype window (it's possible that other window views cause the problem as well). That's what makes the bug sporadically reproducible. Unfortunately, the only known workaround at this time is to restart Pro. We hope to fix this issue in an upcoming patch. Update: Unfortunately, we won't be able to fix this until the 2.3 release. --Rich
... View more
07-16-2018
01:01 PM
|
3
|
0
|
1007
|
|
POST
|
Luke, I don’t think you’re missing anything and it sounds like you understand. This is how we chose to implement it. Feature services tends to have a map-focused rather than database-focused viewpoint, and exposing the original tablenames is seen as exposing an unnecessary implementation detail. Admittedly, this complicates an application like yours that tries to treat feature services and client-server databases in the same way. --Rich
... View more
07-05-2018
08:38 AM
|
0
|
1
|
2870
|
|
POST
|
Luke, Sorry for the delay. By far the easiest way to open a table is to pass in the layer ID as a string to OpenDataset. using (Table myTable = geodatabase.OpenDataset<Table>("2"); If you don't know the layer ID, the safest way is to get a list of the table definitions in the geodatabase. Loop through that list until you find one whose alias matches the alias of the table you wish to open. You can then get the changed name from that TableDefinition object. Consider this code: Table GetTableFromAlias(Geodatabase geodatabase, String aliasName)
{
string tableName = "";
// Find the table name of the table whose alias matches
IReadOnlyList<TableDefinition> tableDefs = geodatabase.GetDefinitions<TableDefinition>();
foreach (TableDefinition tableDef in tableDefs)
{
if (tableDef.GetAliasName() == aliasName)
{
tableName = tableDef.GetName();
}
tableDef.Dispose();
}
// Open the table that corresponds to this table name
if (tableName != "")
{
return geodatabase.OpenDataset<Table>(tableName);
}
else
{
return null;
}
}
... View more
06-28-2018
04:25 PM
|
1
|
3
|
2870
|
|
POST
|
Hi Chris, Unfortunately this isn't possible using the Pro SDK in 2.1 or 2.2. We will try to add it to a future release. --Rich
... View more
06-25-2018
01:51 PM
|
0
|
1
|
1379
|
|
POST
|
Well for what it's worth, the dirty area and error layers should only appear in a map as sublayers of a UtilityNetworkLayer. So if you're searching through all the layers in order, you should be able to find a positive match and exit your loop before getting to the problematic tables. If not, you can just catch the exception and continue.
... View more
06-21-2018
02:38 PM
|
0
|
0
|
658
|
|
POST
|
Hi John, I can confirm that this is an issue. We had intended GetControllerDatasets() to be used with user tables and not the system tables. Could you tell us more about what you are trying to accomplish? (At this point, our proposed solution is to have Table.IsControllerDatasetSupported() return false for these tables, which would fix the bug, but maybe not give you the behavior that you are looking for). --Rich
... View more
06-21-2018
10:47 AM
|
0
|
2
|
658
|
|
POST
|
Hi Emiliano, Sorry, we do not have any experience with the entity framework. -Rich
... View more
06-20-2018
10:44 AM
|
0
|
0
|
639
|
|
POST
|
So there's an Oracle limitation with 1000 clauses in an "in" clause, but you're failing with a much smaller number of records, right? Do you have a reproducible case that you can send to support? --Rich
... View more
06-18-2018
09:01 AM
|
0
|
2
|
1269
|
|
POST
|
This isn't something we've seen before. In theory, we know what is causing this; the error code tells us that the Variant's type isn't valid. In practice, we don't know what could be causing this. If you have a consistent, or sometimes consistent, reproducible case, could you please log it with support? Thanks, --Rich
... View more
06-15-2018
09:12 AM
|
0
|
0
|
1182
|
|
POST
|
Hi Bart, I wrote a few lines of code and was able to select 500 features using FeatureLayer.Select(queryFilter, SelectionCombinationMethod.Add), where the queryFilter returned 200 rows at a time. This was with a feature service workspace. Could you tell me more about what kind of data source you were using, and how you went about selecting the records? Code snippets would be fine. Thanks, --Rich
... View more
06-14-2018
10:38 AM
|
0
|
4
|
1269
|
|
POST
|
Luke, I'm not sure I understand the question. You can get a Table object from a Geodatabase object using OpenDataset<Table>. This is true if the Geodatabase object comes from a file geodatabase, an enterprise client-server geodatabase or a feature service geodatabase. What am I missing? --Rich
... View more
06-14-2018
10:07 AM
|
0
|
6
|
2870
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | yesterday | |
| 2 | 2 weeks ago | |
| 1 | 07-17-2025 08:47 AM | |
| 1 | 08-12-2022 01:35 PM | |
| 1 | 06-28-2018 04:25 PM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|