Is there a way to use GMap.NET to draw a line that crosses the antimeridian?

47 views Asked by At

I have two coordinates in the Pacific Ocean. One is on the east side of the antimeridian (51.8782997131348, -176.658004760742), the other is on the west side of it (52.7162017822266, 174.091995239258).

My objective is to use GMap to display a line between those two coordinates using the shortest direction.

Unfortunately, GMap only displays the line in the longest direction, a direction that makes the line cross almost the entire world map. That is the problem I am trying to solve. It seems that GMap.NET is bound to the antimeridian like a global map made out of paper.

Looking forward to your thoughts and suggestions.

// If you want to see the problem for yourself, here is a code snippet.

    this.gMap.MapProvider = GoogleHybridMapProvider.Instance;
    GMaps.Instance.Mode = AccessMode.ServerOnly;

    List<PointLatLng> routePoints = new()
    {
        new PointLatLng(51.8782997131348, -176.658004760742), // PADK - Adak
        new PointLatLng(52.7162017822266, 174.091995239258) // PASY - Shemya Island
    };

    GMapRoute route = new(routePoints, "MyRoute")
    {
        Stroke = new Pen(ColorTranslator.FromHtml("#FF00FF"), 2f)
    };

    gMap.Overlays.Add(new GMapOverlay("Routes"));
    gMap.Overlays[0].Routes.Add(route);
    gMap.ZoomAndCenterRoutes("Routes");

// Here is what you will see

enter image description here

0

There are 0 answers