|
POST
|
Thank you both for reporting this issue. ServiceFeatureTable where clause need to comply with the server back-end database as well. This is a good workaround. Note, however that QueryTask result will not include any new features that had not been pushed to the server yet. To query cached results including local edits (i.e. new feature added, updated feature), you will need to use SQLite syntax with forceLocal parameter set to true. Only for testing purposes, I set ServiceFeatureTable.Where to a clause that will yield no result and on query button click, I use QueryTask with query that service supports, QueryAsync(ids) to populate result onto my table and QueryAsync(queryFilter, true) with query that SQLite supports. xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"> <Grid> <esri:MapView x:Name="MyMapView"> <esri:Map InitialViewpoint="-117.22032735256052,34.03653059222634,-117.16707501525003,34.089782929536824,4326"> <esri:ArcGISTiledMapServiceLayer ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" /> <esri:FeatureLayer ID="MyLayer"> <esri:ServiceFeatureTable ServiceUri="http://sampleserver6.arcgisonline.com/arcgis/rest/services/PhoneIncidents/MapServer/0" Where="1=2" OutFields="closeddate"/> </esri:FeatureLayer> </esri:Map> </esri:MapView> <Button VerticalAlignment="Top" HorizontalAlignment="Center" Content="Query" Click="Button_Click" /> </Grid> private async void Button_Click(object sender, RoutedEventArgs e) { string message = null; try { var layer = MyMapView.Map.Layers["MyLayer"] as FeatureLayer; var table = layer.FeatureTable; ((ServiceFeatureTable)table).Where = null; var task = new QueryTask(new Uri(((ServiceFeatureTable)table).ServiceUri)); var result = await task.ExecuteObjectIDsQueryAsync(new Query("closeddate > date '2012-12-01'")); if (result != null) { var features = await table.QueryAsync(result.ObjectIDs); } var localFeatures = await ((ServiceFeatureTable)table).QueryAsync(new QueryFilter() { WhereClause = "datetime(closeddate, 'utc') > datetime('2012-12-01')" }, true); } catch (Exception ex) { message = ex.Message; } if (!string.IsNullOrWhiteSpace(message)) MessageBox.Show(message); }
... View more
10-22-2014
03:35 PM
|
0
|
0
|
2984
|
|
POST
|
Hi Christopher, I'm not sure I understand the question. Are you asking to move geometry by some distance or do you want to store distance? If it is the former, you can still use MapPoint.MoveTo() specifying current position and the distance you want to move by, in this example I am only moving X by distance from GeometryService. In this sample, I am using Editor to add my 3 graphics and then I move third graphic by the distance between first and second graphic. If you need the latter, you can use graphic.Attributes["distance"] = distance to store it and to retrieve it you just need to cast back to double. xmlns:esri="http://schemas.esri.com/arcgis/client/2009"> <UserControl.Resources> <esri:SimpleMarkerSymbol x:Key="SMS" /> <esri:Editor x:Key="MyEditor" LayerIDs="MyLayer" Map="{Binding ElementName=MyMap}" GeometryServiceUrl="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer"/> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <esri:Map x:Name="MyMap"> <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" /> <esri:GraphicsLayer ID="MyLayer" /> </esri:Map> <StackPanel VerticalAlignment="Top" HorizontalAlignment="Center" DataContext="{StaticResource MyEditor}"> <Button Content="Add" Command="{Binding Add}" CommandParameter="{StaticResource SMS}" /> <Button Content="Move" Click="Button_Click" /> </StackPanel> </Grid> public EditorSample() { InitializeComponent(); var editor = this.Resources["MyEditor"] as Editor; editor.Map = MyMap; } private async void Button_Click(object sender, RoutedEventArgs e) { var layer = MyMap.Layers["MyLayer"] as GraphicsLayer; if (layer.Graphics.Count > 2) { var first = layer.Graphics[0]; var second = layer.Graphics[1]; var distance = await GetDistanceAsync(first.Geometry, second.Geometry); var third = layer.Graphics[2]; var mapPoint = (MapPoint)third.Geometry; mapPoint.MoveTo(mapPoint.X + distance, mapPoint.Y); } }
... View more
10-21-2014
01:08 PM
|
0
|
0
|
750
|
|
POST
|
Hi Mike, Thank you for reporting this bug. I'm able to reproduce the issue. You can however, do the following to get the FullExtent. var table = await ShapefileTable.OpenAsync(@"C:\Users\jenn6286\Downloads\states_21basic\states.shp"); var features = await table.QueryAsync(new QueryFilter(){WhereClause= "1=1"}); if (features != null) { Envelope fullExtent = GeometryEngine.Union(from f in features where f.Geometry != null select f.Geometry).Extent; } If you wanted current extent, you can use SpatialQueryFilter with Geometry=MapView.Extent.
... View more
10-21-2014
11:14 AM
|
0
|
0
|
963
|
|
POST
|
Hi Dave and Chris, Thank you both for your feedback. I will log the issue. You're both right that map should not be unresponsive. I will check whether Environment.Newline could be supported in the future. Thanks. Jennifer
... View more
10-21-2014
10:52 AM
|
0
|
0
|
1942
|
|
POST
|
Sorry, I think the ProjectGeometryAsync in my previous post will have compile errors. SpatialReference.AreEqual takes a 3rd parameter for ignoring null and since code below is an async method, it should have return Task<Geometry>. The idea is before features are saved, you update their geometry into the expected SpatialReference. private async Task<Geometry> ProjectGeometryAsync(Geometry inputGeometry, SpatialReference outSR) { if (outSR == null || inputGeometry == null || SpatialReference.AreEqual(outSR, inputGeometry.SpatialReference, false)) return inputGeometry; else if (SpatialReference.AreEqual(inputGeometry.SpatialReference, SR_3857, false) && SpatialReference.AreEqual(outSR, SR_4326, false)) return new WebMercator().ToGeographic(inputGeometry); else if (SpatialReference.AreEqual(inputGeometry.SpatialReference, SR_4326, false) && SpatialReference.AreEqual(outSR, SR_3857, false)) return new WebMercator().FromGeographic(inputGeometry); else { var task = new GeometryService("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer"); var result = await task.ProjectTaskAsync(new Graphic[] { new Graphic() { Geometry = inputGeometry } }, outSR); if (result != null && result.Results != null && result.Results.Count > 0) return result.Results[0].Geometry; } return inputGeometry; }
... View more
10-20-2014
02:43 PM
|
0
|
1
|
1200
|
|
POST
|
You can subscribe to FeatureLayer.BeginSaveEdits and update the geometry before they get saved. For example, see code below (assuming you have Microsoft.Bcl.Async installed from Nuget). When projecting geometries to SpatialReference other than 4326 and 3857, you can use GeometryService.Project. Otherwise, you can also use event-based example is in the SDK: ArcGIS API for Silverlight - Interactive Samples | ArcGIS for Developers private async void FeatureLayer_BeginSaveEdits(object sender, ESRI.ArcGIS.Client.Tasks.BeginEditEventArgs e) { var layer = (FeatureLayer)sender; if (e.Adds != null) { foreach (var g in e.Adds) g.Geometry = await ProjectGeometryAsync(g.Geometry, layer.SpatialReference); } } private SpatialReference SR_4326 = new SpatialReference(4326); private SpatialReference SR_3857 = new SpatialReference(3857); private async Geometry ProjectGeometryAsync(Geometry inputGeometry, SpatialReference outSR) { if (outSR == null || inputGeometry == null || SpatialReference.AreEqual(outSR, inputGeometry.SpatialReference)) return inputGeometry; else if( SpatialReference.AreEqual(inputGeometry.SpatialReference, SR_3857) && SpatialReference.AreEqual(outSR, SR_4326)) return new WebMercator().ToGeographic(inputGeometry); else if( SpatialReference.AreEqual(inputGeometry.SpatialReference, SR_4326) && SpatialReference.AreEqual(outSR, SR_3857)) return new WebMercator().FromGeographic(inputGeometry) else { var task = new GeometryService("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer"); var result = await task.ProjectTaskAsync(new Graphic[]{new Graphic(){Geometry = inputGeometry}}, outSR); if(result != null && result.Results != null && result.Results.Count > 0) return result.Results[0].Geometry; } }
... View more
10-20-2014
02:19 PM
|
0
|
0
|
1200
|
|
POST
|
Hi Chris, I can't seem to reproduce the issue with 10.2.4. I am using the following code though: Text = "a\nb\nc" // where '\n' places the next sets of characters in new line. xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"> <Grid> <esri:MapView x:Name="MyMapView"> <esri:Map > <esri:ArcGISTiledMapServiceLayer ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" /> </esri:Map> <esri:MapView.GraphicsOverlays> <esri:GraphicsOverlay ID="Overlay" /> </esri:MapView.GraphicsOverlays> </esri:MapView> <Button VerticalAlignment="Top" HorizontalAlignment="Center" Content="Add" Click="Button_Click" /> </Grid> private async void Button_Click(object sender, RoutedEventArgs e) { string message = null; try { var mp = await MyMapView.Editor.RequestPointAsync(); var g = new Graphic() { Geometry = mp, Symbol = new TextSymbol() { Text = "a\nb\nc" } }; var o = MyMapView.GraphicsOverlays["Overlay"] as GraphicsOverlay; o.Graphics.Add(g); } catch (Exception ex) { message = ex.Message; } if (!string.IsNullOrWhiteSpace(message)) MessageBox.Show(message); }
... View more
10-20-2014
01:46 PM
|
0
|
3
|
1942
|
|
POST
|
Actually, the service I was using had some scale dependency. And as soon as I zoomed in, the features showed up. If you are also using a scale-dependent service, can you try the following? - Load map without tiled layer (just the feature layer) - Get the MapView.Extent.GetCenter() and use this as InitialViewPoint. In my case, the service was visible at specific scale. You can check the service metadata <esri:MapView x:Name="MyMapView" > <esri:Map> <esri:Map.InitialViewpoint> <esri:ViewpointCenter X="1109557.6630192" Y="598570.670764685" SpatialReferenceID="2285" Scale="48000"/> </esri:Map.InitialViewpoint> <esri:ArcGISTiledMapServiceLayer ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" /> <esri:FeatureLayer ID="MyLayer"> <esri:ServiceFeatureTable Mode="Snapshot" ServiceUri="your service with SR=2285" /> </esri:FeatureLayer> This seems to work just fine so I don't think there is any projection or rendering issue as I initially thought. Could you confirm if you still find issues? Thanks.
... View more
10-17-2014
01:10 PM
|
0
|
1
|
2852
|
|
POST
|
Hi Matt, I am not aware of any known issue that will prevent map from displaying features with different SpatialReference. But unfortunately, I'm able to reproduce the issue. I also tried the following. I'm not sure if you are working with ServiceFeatureTable or ArcGISFeatureTable. At any case, they both have RowCount and QueryAsync. In my repro sample, after the map loads, the table seems empty (no request for features was made - it should have). Performing query, returns features in the correct spatial reference, matching MapView.SpatialReference=3857 yet no features display. private async void Button_Click(object sender, RoutedEventArgs e) { string message = null; var layer = MyMapView.Map.Layers["MyLayer"] as FeatureLayer; try { var table = ((ServiceFeatureTable)layer.FeatureTable); if (!table.IsInitialized) { await table.InitializeAsync(); } if (table.RowCount <= 0) { var features = await layer.FeatureTable.QueryAsync(new QueryFilter() { WhereClause = "1=1" }); } } catch (Exception ex) { message = ex.Message; } if (!string.IsNullOrWhiteSpace(message)) MessageBox.Show(message); } I will create an issue for this. But could you try the same code and let me know whether table is intialized properly, have rows and if performing query display features for you? Thanks. Jennifer
... View more
10-17-2014
12:27 PM
|
0
|
1
|
2852
|
|
POST
|
Hi Mark, Thank you. This is very helpful. I can reproduce the issue consistently even without your helper class. GraphicsLayer with labeling enabled crashes with AccessViolationException when it contains an Envelope geometry. I have logged an issue and we'll try to get it fixed in future releases.
... View more
10-17-2014
10:41 AM
|
0
|
1
|
2019
|
|
POST
|
Hi Sofia, Are you talking about this SDK sample? ArcGIS API for Silverlight - Interactive Samples | ArcGIS for Developers . sampleserver6 could have been down when you tried it. See first that when you click "Export Map" in the sample that a pop-up is not blocked and you're able to see the printout on a separate window like this or maybe opened in another tab. If you copied the XAML and Code-Behind C# as-is but using the namespace of your app, it should still work. You can also click "Download samples" which will take you to github. Click "Download ZIP". Open the ArcGISSilverlightSDK solution file and make ArcGISSilverlightSDKWeb as the startup project.
... View more
10-16-2014
04:42 PM
|
0
|
0
|
595
|
|
POST
|
Hi, I'm not sure if you simply want to update symbol template to include an arrow or if you wanted an arrow shape. For custom symbols, you can try this SDK sample: ArcGIS API for Silverlight - Interactive Samples | ArcGIS for Developers or symbol gallery: ArcGIS API for Silverlight - Symbol Gallery. Basically, you will need a LineSymbol and define a Control Template that includes an Arrow Shape. If you want an arrow shape, you can try this SDK sample: ArcGIS API for Silverlight - Interactive Samples | ArcGIS for Developers click on the button with "Add an arrow" tooltip and then mouse down + drag + up to create this shape. By default, this creates a Polygon but you can subscribe to DrawComplete and convert to Polyline. void Button_Click(object sender, RoutedEventArgs e) { var draw = new Draw(MyMap); draw.DrawMode = DrawMode.Arrow; draw.DrawComplete += draw_DrawComplete; draw.IsEnabled = true; } void draw_DrawComplete(object sender, DrawEventArgs e) { ((Draw)sender).DrawComplete -= draw_DrawComplete; var polygon = (Polygon)e.Geometry; var polyline = new Polyline() { SpatialReference = polygon.SpatialReference }; foreach (var r in polygon.Rings) polyline.Paths.Add(r); var layer = MyMap.Layers["MyLayer"] as GraphicsLayer; layer.Graphics.Add(new Graphic() { Geometry = polyline, Symbol = new SimpleLineSymbol() }); }
... View more
10-16-2014
03:37 PM
|
0
|
0
|
1976
|
|
POST
|
Hi Francois, Double-click to complete the draw for MeasureAction is the default behavior. If you need draw to be completed by other means, you would have to create your own measure class that will respond to these events. Basically, use the Draw class from the API, subscribe to these events and perform your calculations. var draw = new Draw(MyMap); draw.DrawBegin += draw_DrawBegin; draw.VertexAdded += draw_VertexAdded; draw.DrawComplete += draw_DrawComplete; draw.IsEnabled = true; You can then create a command that will call into draw.CompleteDraw() to programmatically complete the draw.
... View more
10-16-2014
02:53 PM
|
0
|
0
|
796
|
|
POST
|
Sorry, I was looking from a expanded view of your post from the main landing page: ArcGIS Runtime SDK for .NET I didn't realize attachments are only visible from within the message. Anyway, I used your helper class with this very simple sample. I commented out the workaround of replacing g with PolygonBuilder but I'm not able to reproduce the issue. It seems to work without AccessViolationException. I ran the sample against the final released version 10.2.4.748 xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"> <Grid x:Name="LayoutRoot" Background="White"> <esri:MapView x:Name="MyMapView"> <esri:Map > <esri:ArcGISTiledMapServiceLayer ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" /> <esri:GraphicsLayer ID="MyLayer" /> </esri:Map> </esri:MapView> <StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Center"> <Button Content="Flash" Click="Button_Click" /> </StackPanel> </Grid private async void Button_Click(object sender, RoutedEventArgs e) { string message = null; try { var geometry = await MyMapView.Editor.RequestShapeAsync(DrawShape.Envelope); var graphic = new Graphic() { Geometry = geometry, Symbol = new SimpleFillSymbol() }; var layer = MyMapView.Map.Layers["MyLayer"] as GraphicsLayer; layer.Graphics.Add(graphic); clsGraphicHelper.FlashGeometry(MyMapView, geometry, geometry.Extent.GetCenter()); } catch (TaskCanceledException) { } catch (Exception ex) { message = ex.Message; } if (!string.IsNullOrWhiteSpace(message)) MessageBox.Show(message); }
... View more
10-16-2014
11:43 AM
|
0
|
3
|
2019
|
|
POST
|
Hi, Thank you for reporting this bug.If you had tried to move the geometry using EditGeometry, Editor, or EditorWidget, there is currently a bug that SpatialReference becomes null if geometry was Polyline/Polygon after this operation. We will try to include the fix in future versions. In the meantime, you can subscribe to EditGeometry.GeometryEdit and correct the geometry SpatialReference spatialReference; private void EditGeometry_GeometryEdit(object sender, EditGeometry.GeometryEditEventArgs e) { if (e.Action == EditGeometry.Action.GeometryMoved) { // this should not happen if (e.Geometry.SpatialReference == null) { if (spatialReference == null && e.Graphic.Geometry.SpatialReference != null) spatialReference = e.Graphic.Geometry.SpatialReference; } } if (e.Action == EditGeometry.Action.EditCompleted) { // this is just a workaround if(e.Graphic.Geometry.SpatialReference == null && spatialReference != null) e.Graphic.Geometry.SpatialReference = spatialReference; } }
... View more
10-15-2014
06:06 PM
|
0
|
0
|
971
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-11-2025 01:30 PM | |
| 1 | 06-06-2025 10:14 AM | |
| 1 | 03-17-2025 09:47 AM | |
| 1 | 07-24-2024 07:32 AM | |
| 1 | 04-05-2024 06:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
03-12-2026
09:38 AM
|