Hello
Is there any guidlines/functions on how to ensure a series is visible in a XamGeographicMap?
I have a GeographicPolylineSeries. When the form is loaded I want to zoom in on the series and make it is visible with a little margin.
Hi logimatic,
Unfortunately there is no zoom to functionality or 'view all' capability when it comes to a series that takes up little space in the map. If you are manually providing points to the polyline series then you should be able to calculate the min/max longitude and latitude from all those points and with the min/max you can update the maps WindowRect to encompass that rectangle. GetZoomFromGeographic will help you construct that new window rect.
// calculate the min/max longitude and latitudes of your polyline points var minLongitude = GetMinLongitude(); var maxLongitude = GetMaxLongitude(); var minLatitude = GetMinLatitude(); var maxLatitude = GetMaxLatitude(); // use the GetZoomFromGeographic method to generate a new WindowRect var rect = this.geoMap.GetZoomFromGeographic(new Point(minLongitude, minLatitude), new Point(maxLongitude, maxLatitude)); this.geoMap.WindowRect = rect;
Thanks.
var rect = mapControl.GetZoomFromGeographic(new Point(minLongtitude, maxLatitude), new Point(maxLongtitude, minLatitude));
... + a little offset worked.