Coordinate Converters

By default all of built-in RadMap providers (Bing Maps, OpenStreetMap) use the standard Mercator projection. When reading shape files with different projections, then you can use a coordinate converter. To do this, set the CoordinateConverter property of MapShapeReader.

The RadMap contains two built-in converters which convert coordinates from EPSG:27700 and EPSG:3857 to EPSG:4326 projection.

  • OSGB36Converter
  • EPSG900913Converter

The converter (OSGB36Converter/ EPSG900913Converter) can be specified by setting it to the MapShapeReader.CoordinateConverter property.

Example 1: Setting CoordinateConverter property

<telerik:RadMap> 
    <telerik:RadMap.Providers> 
        <telerik:OpenStreetMapProvider /> 
    </telerik:RadMap.Providers> 
    <telerik:VisualizationLayer > 
        <telerik:VisualizationLayer.Reader> 
            <telerik:AsyncShapeFileReader > 
                <telerik:AsyncShapeFileReader.CoordinateConverter> 
                    <telerik:EPSG900913Converter /> 
                </telerik:AsyncShapeFileReader.CoordinateConverter> 
            </telerik:AsyncShapeFileReader> 
        </telerik:VisualizationLayer.Reader> 
    </telerik:VisualizationLayer> 
</telerik:RadMap> 

Custom Coordinate Converter

The API of the RadMap allows you to use a custom coordinate converter by implementing the ICoordinateConverter interface.

Example 2: Implement ICoordinateConverter

public class CustomCoordinateConverter : ICoordinateConverter 
{ 
    public LocationCollection ConvertBack(LocationCollection collection) 
    {            
        return new LocationCollection(); 
    } 
 
    public LocationCollection ConvertTo(LocationCollection collection) 
    { 
        return new LocationCollection(); 
    } 
 
    public Location FromLocation(Location location) 
    { 
        return new Location(); 
    } 
 
    public Location ToLocation(object coordinates) 
    { 
        return new Location(); 
    } 
 
    public string ToString(Location location) 
    { 
        return location.ToString(); 
    } 
} 
The custom coordinate converter can be assigned to the MapShapeReader.CoordinateConverter property.

Example 3: Setting CustomCoordinateConverter in XAML

<telerik:RadMap> 
    <telerik:RadMap.Providers> 
        <telerik:OpenStreetMapProvider /> 
    </telerik:RadMap.Providers> 
    <telerik:VisualizationLayer > 
        <telerik:VisualizationLayer.Reader> 
            <telerik:AsyncShapeFileReader > 
                <telerik:AsyncShapeFileReader.CoordinateConverter> 
                    <local:CustomCoordinateConverter /> 
                </telerik:AsyncShapeFileReader.CoordinateConverter> 
            </telerik:AsyncShapeFileReader> 
        </telerik:VisualizationLayer.Reader> 
    </telerik:VisualizationLayer> 
</telerik:RadMap> 

See Also

In this article
Not finding the help you need? Improve this article