POST
|
I am currently working on a solution that requires me to submit an inspection to a layer and this inspection may contain one or more defects that are added to a defect layer. The relationship between the two feature layers is already set up on the server. Due to client restrictions, the latest version of the SDK I am able to use is 100.2.1 When an inspection is submitted, the field INSPECTION_ID is automatically populated with an auto-incrementing value. Since this value is set at the server side, I need to refresh the local copy to fetch this new value. The current version of the SDK includes a Refresh() method on the feature, however this isn't available and the closest I can find in 100.2.1 is the RefreshObjectId() method. I have tried some alternatives such as LoadAsync() and RetryLoadAsync() but the inspection id attribute seems to remain null. If I lookup the record on the REST explorer in a browser then I can see an id has been generated. I have also tried experimenting with the RelateFeature() method, but that doesn't seem to help at all either. Is there an alternative way of being able to fetch all the updated attributes after creating a feature at all?
... View more
11-02-2020
06:37 AM
|
0
|
1
|
121
|
POST
|
So I've had a bit of play around with UniqueValueRenderer but not much luck so far, not sure if I'm misunderstanding how it maps the graphics attributes. I'm adding graphics to the overlay now with both reference and status attributes: MapPoint loc = new MapPoint(...); List<KeyValuePair<string, object>> attributes = new List<KeyValuePair<string, object>> { new KeyValuePair<string, object>("Reference", x.Reference), new KeyValuePair<string, object>("Status", x.Status.ToString()) // x.Status is an enum so must be converted to a string } return new Graphic(loc, attributes); I'm then creating the following renderer: var renderer = new UniqueValueRenderer(); renderer.FieldNames.Add("Status"); renderer.UniqueValues.Add(new UniqueValue("Operational Status", "Operational", _operationalMarkerSymbol, "Operational")); renderer.UniqueValues.Add(new UniqueValue("Defective Status", "Defective", _defectiveMarkerSymbol, " Defective ")); ... _customOverlay.Renderer = renderer; Overlays = new GraphicsOverlayCollection() { _ custom Overlay }; Currently I am not seeing any symbols on the map whatsoever, not sure if it is struggling to map the Status attribute from the graphic to the renderer field? The reference attribute isn't used to select the symbol but will be used when identifying what graphic was selected.
... View more
02-27-2020
05:05 AM
|
0
|
0
|
51
|
POST
|
Thanks Morten, I'll take a look into the UniqueValueRenderer and see if that helps. I've tried sending you a PM regarding the project but I believe you'll need to follow me first? Happy to share the details of what we're looking to achieve though.
... View more
02-26-2020
03:23 AM
|
0
|
1
|
51
|
POST
|
I am currently implementing ArcGIS 100.2.1 as we have a requirement to support UWP on Windows 10 LTSB (1607) and have a couple of issues with the application locking up while initialising the map and perhaps more crucially, an issue whereby we can't seem to add a large number of graphics to the map. I've tried a handful of different approaches such as calling the RenderGraphics() method synchronously from the constructor and on a background thread from the MapLoaded event. Currently I have the following implementation (abridged for readability): View Model public class ExampleMapViewModel : Screen { private readonly PictureMarkerSymbol _markerStyleA ; private readonly PictureMarkerSymbol _markerStyleB ; private readonly PictureMarkerSymbol _markerStyleC ; // List of custom markers (generated by a service) with status and locations private IList < MarkerRef > _markers ; public Map Map { get ; set ; } public GraphicsOverlayCollection Overlays { get ; set ; } public ExampleMapViewModel ( ) { Map = new Map ( Basemap . CreateLightGrayCanvasVector ( ) ) ; Overlays = new GraphicsOverlayCollection ( ) ; Map . Loaded + = Map_Loaded ; GraphicsOverlay customOverlay = new GraphicsOverlay ( ) { Id = "CustomOverlay" , MinScale = 36000 , SelectionColor = Color . FromArgb ( 77 , 0 , 0 , 0 ) } ; Overlays . Add ( customOverlay ) ; _markerStyleA = new PictureMarkerSymbol ( new Uri ( "ms - appx : / //Assets/MarkerStyleA.png", UriKind.RelativeOrAbsolute)) { Width = 24, Height = 24 }; _markerStyleB = new PictureMarkerSymbol ( new Uri ( "ms - appx : / //Assets/MarkerStyleB.png", UriKind.RelativeOrAbsolute)) { Width = 24, Height = 24 }; _markerStyleC = new PictureMarkerSymbol ( new Uri ( "ms - appx : / //Assets/MarkerStyleC.png", UriKind.RelativeOrAbsolute)) { Width = 24, Height = 24 }; // Returns a collection of 2000 markers with ids, labels, coordinates and status _markers = _markerService . GetMarkers ( ) ; } public async Task RenderGraphics ( ) { await Task . Run ( ( ) = > { var overlay = Overlays . FirstOrDefault ( x = > x . Id == "CustomOverlay" ) ; if ( overlay != null ) { for ( var i = 0 ; i < _markers . Count ; i ++ ) { var graphic = CreateGraphic ( _marker [ i ] ) ; overlay . Graphics . Add ( graphic ) ; Debug . WriteLine ( $ "Added graphic {i + 1}" ) ; } } } ) ; } private Graphic CreateGraphic ( MarkerRef marker ) { var loc = new MapPoint ( marker . Longitude , marker . Latitude , SaptialReferences . Wgs84 ) ; var symbol = marker . Status == MarkerStatus . A ? _markerStyleA : marker . Status == MarkerStatus . B ? _markerStyleB : _markerStyleC ; var attributes = new List < KeyValuePair < string , object > > { new KeyValuePair < string , object > ( "Reference" , marker . ref ) } ; var graphic = new Graphic ( loc , attributes , symbol ) ; return graphic ; } private async void Map_Loaded ( object sender , EventArgs e ) { await RenderGraphics ( ) ; } } View < Page ... xmlns: esriui = " using:Esri.ArcGISRuntime.UI.Controls " > < SplitView > <SplitView.Pane> ... </SplitView.Pane> <SplitView.Content> < Grid > < esriui: MapView x: Name = " MapView " Map = " {Binding Map} " GraphicsOverlays = {Binding Overlays}" Loaded = " MapView_Loaded " /> </ Grid > </SplitView.Content> </ SplitView > </ Page > View (Code Behind) public sealed partial class ExampleMapView : Page { public ExampleMapView ( ) { this . InitializeComponent ( ) ; } private void MapView_Loaded ( object sender , RoutedEventArgs e ) { MapView . LocationDisplay . AutoPanMode = Esri . ArcGISRuntime . UI . LocationDisplayAutoPanMode . Recenter ; MapView . LocationDisplay . IsEnabled = true ; } } When the view model is loaded, I can see the output starts to show the 'Added graphic' lines that we defined on 43, but when running in the above code it only gets as far as 29 (the count of _markers is 2000) before the output stops and the application or map control freezes (in this case before the base layer can load). If I move the execution of the RenderGraphics() method into the constructor of the view model then I can get to approximately 120 graphics before it falls over but ultimately the result is the same. Commenting out line 42 where we add the graphic the overlay fixes the problem in so far as all the graphics are generated but it seems to be adding them to the overlay that is causing the issue. I tried a slightly different approach whereby we only added graphics to the overlay that were within the coordinates of the current visible map area which worked slightly better but would ultimately crash after a certain number of graphics had been rendered, even if we cleared the overlay graphics collection every time. Has anyone experienced something similar in the past?
... View more
02-25-2020
04:51 AM
|
0
|
5
|
209
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|