Can the xamMap control be used for the ESRI REST Service?
I am using the following REST for their maps:
http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer
Thanks
Hi,
Unfortunately the surface element is being clipped when it goes out of bounds so using an image brush in this manner will cause the image to get squashed when the surface element is partly occluded.
To support your request we may need to introduce a type of element that does not get clipped by the map boundary in this manner. I would recommend making a feature request.
In the meantime I'll see if there is some other way to satisfy your request, but it may not be possible without additional feature work.
-Graham
I think this *may* be a similar problem that user:dalereed was experiencing http://ko.infragistics.com/community/forums/t/54545.aspx
Hi Stefan,
Thanks for looking into this.Really what I'd like is for a surface element's Image Fill to stay stretched to the surface element's GPS/mapped position, not the screen itself.But right now, the SurfaceElement's Image Fill looks like it gets re-stretched when you try to pan or zoom the surface element partially off the screen.
One potential avenue that I've investigated would be to create a Shapefile from my washington image. But eventually I'd like to write bitmaps and update the image dynamically, changing them several times per second, in which case creating a shapefile becomes highly innefficient (if it's even possible to do at runtime?). So is there a way to stop the surface element from re-stretching on panning the element half-way off the screen?My Solution.Zip
How to reproduce the error/situation:1. load my project & run it2. click and drag to pan the windowView so that the map goes half-way "off the screen".3. Instead of going off the screen (and keeping the same stretch as when loaded), the imagefill gets re-stretched to fit on the screen. :(
Thanks for your time,
-Will
Hello Will,
Thank you for your post. I have been looking into it and it seems like that I am missing something in your scenario, so if this is still an issue for you, could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
I'd like to do a similar thing as grabah above.
I have a code-behind function which gets called during Map_Loaded,
<igMap:XamMap x:Name="map" Loaded="map_Loaded" >
<igMap:XamMap.Layers>
<igMap:MapLayer x:Name="WorldTopoLayer" IsSensitive="False" ShadowFill="Transparent" />
</igMap:XamMap.Layers> </igMap:XamMap>
private void map_Loaded(object sender, RoutedEventArgs e) {
AddPictureToMap("WashingtonTopoLayer", "../img/washington-bw.png", "", Settings.GPSTopLeft.X, Settings.GPSTopLeft.Y, Settings.GPSBottomRight.X, Settings.GPSBottomRight.Y);
}
private void AddPictureToMap(string layerName, String fileContents, String myCaption, double left, double top, double right, double bottom) { if (map == null || map.Layers[layerName] == null) return; // Polyline collection to hold points for shape var lines = new MapPolylineCollection(); var points = new List<Point>(); // Points to make the shape points.Add(new Point(left, top)); points.Add(new Point(right, top)); points.Add(new Point(right, bottom)); points.Add(new Point(left, bottom)); // Convert Geodetic to RelativeCartesian coordinates lines.Add(map.MapProjection.ProjectToMap(points)); var b = new ImageBrush(); b.Opacity = 1; b.Stretch = Stretch.UniformToFill; //tried different settings here: [Stretch.None (no picture shows up), the rest of them have the same problem] if (!string.IsNullOrEmpty(fileContents) && fileContents.StartsWith("../")) b.ImageSource = new BitmapImage(new Uri(fileContents, UriKind.Relative)); // Create surface element and position shape using polylines var surfaceElement = new SurfaceElement { Polylines = lines, Fill = b, Caption = myCaption, StrokeThickness = 0, Name = myCaption }; surfaceElement.ShadowFill = new SolidColorBrush(Colors.Transparent); map.Layers[layerName].Elements.Add(surfaceElement); Rect worldRect = surfaceElement.WorldRect; worldRect = lines.GetWorldRect(); surfaceElement.WorldRect = worldRect; }
this currently works... except that when you try to PAN so that the surface element goes OFF the screen, then instead of going off the screen nicely, the surface element's Fill (ImageBrush) Stretches the Image so that it fits in the remaining portion of the screen (washington gets squashed, but points and lines correctly stay at their GPS coordinates - off the screen). Please help!