POST
|
The user selects a record on a grid. This record has a foreign key to a spatial table. We apply the definition expression like this: string whereClause = GetWhereClauseForLayer(layer); // Complicated logic based on columns the layer's table. layer.DefinitionExpression = whereClause; After that, we center the mapview on the geometry for the corresponding feature(s) We query the table like this: QueryParameters query = new QueryParameters { WhereClause = BuildWhereClause(columnName, ids) //similar, complicated logic }; IEnumerable<Feature> features = await featureLayer.FeatureTable.QueryFeaturesAsync(query); //I just added this foreach block, but it doesn't seem to change anything. foreach (ILoadable feature in features.Cast<ILoadable>()) { await feature.LoadAsync(); } Then we get the list of geometries and find the union and set the viewpoint: IList<Geometry> geometries = features.Where(f => f.Geometry != null).Select(s => s.Geometry).ToList(); Geometry unionedGeometry = GeometryEngine.Union(geometries); await mapView.SetViewpointGeometryAsync(unionedGeometry, 10); One thing that I just noticed now at home where the network is much slower. The map starts showing the feature's actual geometry, without a basemap (grey grid). Then the basemap slowly loads, and when it's done, the feature changes to the generalized shape.
... View more
10-26-2020
07:21 PM
|
0
|
0
|
155
|
POST
|
I am experiencing an issue where features are not fully loading. Their geometry remains generalized. Here is the code I am using (.net arcGISRuntime 100.9.0) Uri serviceUri = new Uri(layerInfo.LayerUrl); CenterlineFeatureLayer = new FeatureLayer(serviceUri); await CenterlineFeatureLayer.LoadAsync(); Map.OperationalLayers.Add(CenterlineFeatureLayer); This happens before the map is visible (it's in another tab of the application). When we view the map it looks like the attached snapshot, map-after-loadAsync. Oddly, if I don't load the layer by commenting out line 3, the geometry seems to be fully loaded. This is a bit hard to demonstrate, but in snapshot Map-no-load, you can see one non-generalized feature. There are other features visible because we apply normally apply definition expression. But the unloaded features don't have the needed columns so the code applies a blank definition expression and nothing is filtered out. A couple of more details: There should be tens of thousands of features in the service feature table. I seem to remember it only loading 1000 records at a time, so maybe its not loading the one I want to see? The features are all over north america, and we set the extent on the mapView after the feature is loaded -- the users selects a record on a different tab, then the map goes to corresponding feature in another tab (using MapView.SetViewpointGeometryAsync). Is there a way to force the features in the mapView's current viewport to load? Do I have to do anything after setting the definition expression? In the examples I've seen, the code just sets the definition expression.
... View more
10-25-2020
10:18 AM
|
0
|
2
|
231
|
POST
|
I am migrating code from .net 10.2. to 100.9.0. We use overlays to show details when the user hovers on a feature. However I can't find how to set the coordinates of the overlay in 100.9.0 (so it appears by the mouse cursor). XAML: <esri:MapView x:Name="CenterlineHistoryMapView" WrapAround="True" MouseMove="CLHistMapView_OnMouseMove"> ... <esri:MapView.Overlays> <esri:OverlayItemsControl> <Border x:Name="MapTooltip" Background="White" BorderBrush="Black" BorderThickness="2" Padding="4" Margin="4" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Collapsed"> <StackPanel x:Name="ToolTipStackPanel"> <TextBlock Text="{Binding Attributes[LINE_DESCRIPTION], StringFormat='Line Description: {0}'}" Foreground="Black" FontWeight="Bold" /> <TextBlock Text="{Binding Attributes[ROUTE_ID], StringFormat='Route Id: {0}'}" Foreground="Black" /> <TextBlock Text="{Binding Attributes[DESIGNATOR], StringFormat='Designator: {0}'}" Foreground="Black" /> </StackPanel> </Border> </esri:OverlayItemsControl> </esri:MapView.Overlays> </esri:MapView> Code behind: // rectangle is derived from mouse event location // I have migrated some of the code to the 100.9 API, like using IdentifyLayerAsync method long[] rows = await _centerlineFeatureLayer.HitTestAsync(CenterlineHistoryMapView, rectangle); if (rows != null && rows.Length > 0) { IEnumerable<Feature> features = await _centerlineFeatureLayer.FeatureTable.QueryAsync(rows); Feature feature = features.FirstOrDefault(); if (feature != null) { _hoverOverlay.Graphics.Add(new Graphic(feature.Geometry, _hoverLineSymbol)); MapTooltip.DataContext = feature; MapTooltip.Visibility = Visibility.Visible; //Looking for the equivalent of this call in 100.9.0 Esri.ArcGISRuntime.Controls.ViewBase.SetViewOverlayAnchor(MapTooltip, CenterlineHistoryMapView.ScreenToLocation(screenPoint)); } else { MapTooltip.Visibility = Visibility.Collapsed; } } On a side note, is would this be better suited as a popup? I'm not understanding the difference between a popup and an overlay.
... View more
10-19-2020
09:52 AM
|
0
|
2
|
114
|
POST
|
Yes, that works. Also exposing it on the layer simplifies a bunch of code. Thank you!
... View more
10-16-2020
10:16 AM
|
0
|
0
|
54
|
POST
|
I'm upgrading from arcgisRuntime .NET SDK 10.2.5 to 100.9.0. I am trying to find a suitable replacement for code like this: string whereClause = "RouteID = 100" //Actually changes based on user interaction ServiceFeatureTable serviceFeatureTable = featureLayer.FeatureTable as ServiceFeatureTable; serviceFeatureTable.Where = whereClause; serviceFeatureTable.RefreshFeatures(false); The intent is we only show a handful (usually only 1) of the features in the feature layer. The where clause is actually built dynamically based on what the user is doing. The closest I can find is setting visibility on the features, but first I have to find all the other features and set their visibility as false: //Hide All Features QueryParameters queryParams = new QueryParameters(); queryParams.WhereClause = "1 = 1"; queryParams.MaxFeatures = Int32.MaxValue; //Doesn't seem to work FeatureQueryResult allFeatures = await featureLayer.FeatureTable.QueryFeaturesAsync(queryParams); long l = allFeatures.Count(); // Just for debugging featureLayer.SetFeaturesVisible(allFeatures.ToList(), false); //Show features matching query string whereClause = "RouteID = 100" queryParams = new QueryParameters(); queryParams.WhereClause = whereClause; FeatureQueryResult filterResults = await featureLayer.FeatureTable.QueryFeaturesAsync(queryParams); featureLayer.SetFeaturesVisible(filterResults.ToList(),true); And this actually doesn't work either because it looks like the max number of features returned is 1000. It also seems very inefficient. Is there more straightforward way of hiding all the features except those that match a SQL type query?
... View more
10-16-2020
09:30 AM
|
0
|
2
|
118
|
POST
|
Hello, I am using ArcRuntime 100.9.0 .NET sdk, and I'm querying a ServiceFeatureTable that contains polylines. The query works, but when I inspect the geometry of the feature, the M values are all NaN. I know the feature does have M values by inspecting the same feature in ArcPro. Also, if I just use a browser to the go to the uri and query (i.e. http/{myserviceURI}/query) , I can set ReturnM to true, and see the M values in the geometry. Code: //Get layer and add to map... Uri serviceUri = new Uri(/**uri string**/); CenterlineLayer = new FeatureLayer(serviceUri); _map.OperationalLayers.Add(CenterlineLayer); ... //Query service QueryParameters queryParams = new QueryParameters(); queryParams.WhereClause = "CENTERLINE_HISTORY_ID = 5"; queryParams.ReturnGeometry = true; FeatureQueryResult queryResult = await CenterlineLayer.FeatureTable.QueryFeaturesAsync(queryParams); SelectedCenterline = queryResult.First(); //See screenshot to see NaN as the M Value In a browser I can go to uri_string/query?where=CENTERLINE_HISTORY_ID+%3D+5&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&returnGeometry=true&returnTrueCurves=false&outSR=3857&returnM=true&f=pjson I get the M values: { ... "features": [ { "attributes": { "COMPANY_NAME": "HEC" }, "geometry": { "hasM": true, "paths": [ [ [ -10194353.727657143, 3462589.2523800787, 0 ], [ -10194351.748618515, 3462584.1271569589, 15.600000000005821 ], [ -10193529.228768408, 3460914.2605744163, 5303.8999999999942 ], [ -10191907.687540743, 3458520.5200898903, 13524.100000000006 ], [ -10191835.948896401, 3458416.2688311678, 13883.940000000002 ], .....} Is there something I need to set on the QueryParameters? I explicitly set ReturnGeometry to true, although it looks like it defaults to true.
... View more
09-03-2020
07:52 AM
|
0
|
3
|
80
|
POST
|
I am working on a Arc Pro .NET add in that uses APR feature classes. I would like to programmatically determine if a feature class is an engineering network or derived network, and what it's related feature class would be. i.e. this feature class is an engineering network, and its derived network is X, and vise versa. Is this possible in the .NET SDK? I briefly saw some documentation about determining this through arcpy. In the case that I would need to wrap an arcpy call, I assume that the arc pro instance this is running on, would need to have a valid licence for the Location Reference Extension. I ask because not all our developers have this licence.
... View more
01-23-2020
07:58 AM
|
0
|
1
|
73
|
POST
|
I was watching an Esri video from this year's DevSummit presented by Uma Harano It demonstrates how to add controls to a gallery in a ribbon. I'm unclear on how to actually add controls (e.g. buttons) to a Gallery. In the video, Uma adds a custom class, AcmeGalleryItem, which is constructed from ComponentElements. Is the code for AcmeGalleryItem available? It doesn't seem trivial. I also looked at the Pro Guide for Galleries, and it says: The actual contents of a gallery are normally populated at runtime. Gallery items are modeled through the GalleryItem class. GalleryItems have the following properties: Icon or imagePath, Text, Group, and Tooltip. Custom GalleryItems can be created through inheritance to encapsulate any additional properties and/or behavior as needed. From this it seems the GalleryItems are pretty simplistic. I would imagine that Uma's AcmeGalleryItem holds the actual button as a member variable, but I'm not sure how to instantiate a control defined in DAML. It at least needs to be able to get the icon, name and tooltip; and hopefully pass through events like click, mouseover, etc. Again, it seems a lot of magic happens in AcmeGalleryItem.
... View more
08-08-2019
07:53 AM
|
0
|
1
|
58
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|