Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
860
Sereies visible
posted

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.

Parents
No Data
Reply
  • 34510
    Verified Answer
    Offline posted

    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;

Children