Nov 17, 2013 at 7:09 PM
Edited Nov 17, 2013 at 7:15 PM
As of version 1.9.0 the map control has a modified calculation of viewport positions from MapPanel.Location property values. Viewport positions are now kept near the map center, and remain visible when the map center crosses 180° latitude (i.e jumps from
E180 to W180 and vice versa).
This change does however not apply to MapRectangle, since here viewport positions are not continuously recalculated during map viewport changes. Instead the "logical" (Mercator-transformed) coordinates are calculated once (in UpdateData) and subsequently
transformed by the
in MapBase. This is done for performance reasons.
You may however use the following workaround until I finally come up with a solution. First, take care that the value of the
property is always greater than the
value in your application. It doesn't matter if
is less then -180 or
is greater than 180.
Then add a handler for the
event and check if the MapRectangle and the
Location of the map lie on different sides of 180° longitude. If that is the case, adjust the
private void MapViewportChanged(object sender, EventArgs e)
var map = sender as Map;
if (Math.Abs(map.Center.Longitude - mapRectangle.West) > 180d)
if (mapImage1.West < 0d)
mapRectangle.West += 360d;
mapRectangle.East += 360d;
mapRectangle.East -= 360d;
mapRectangle.West -= 360d;