Edit this page

Wraparound

The WrapAround feature provides infinite horizontal panning to the RadMap control which gives continuous experience as the user pans the viewport east or west.

The feature is not enabled by default. To turn it on you can set the WrapAround property of the RadMap to True.

Example 1: Setting the WrapAround property

<telerik:RadMap WrapAround="True">
    <telerik:RadMap.Provider>
        <telerik:OpenStreetMapProvider />
    </telerik:RadMap.Provider>
</telerik:RadMap>

Figure 1: Wraparound functionality enabled

When the wraparound is enabled, the longitude of the map's viewport can exceed the valid geographical boundaries (from -180 to 180 degrees in the default Mercator projection) when you pan the viewport. The Location Conversion section of this article explains how to convert shifted locations to valid geographical boundaries (-180 to 180).

Services like Geocode, Search, Routing use Longitude within the valid geographical boundaries.

Location Conversion

RadMap exposes two methods which you can use to convert map coordinates.

  • GetShiftedLocation(Location standardLocation)

    This method accepts a location in the standard longitude range of the Mercator projection ( from -180 to 180 degrees), and returns a shifted location based on the shift of the map's center when panned outside of the standard longitude range.

    Example 2: GetShiftedLocation method

        Location shiftedLocation = this.myRadMap.GetShiftedLocation(standardLocation);  
    
  • GetCoercedLocation(Location shiftedLocation)

    This method accepts shifted coordinates and returns a Location object by converting shifted location's to standard location in the range from -180 to 180 degrees.

    Example 3: GetCoercedLocation method

        Location desiredLocation = this.myRadMap.GetCoercedLocation(shiftedLocation);
    

    MiniMap Support

When the wraparound feature is enabled on the RadMap the built-in MiniMap also has this functionality turned on. But when you are using the MiniMap as a standalone control you have to explicitly set its WrapAround property to True in order to turn the feature on.

The WrapAround property of the RadMap control that is linked to the MiniMap has a higher priority than the WrapAround property of the MiniMap.

See Also