Skip to content

Latest commit

 

History

History
100 lines (84 loc) · 3.37 KB

coordinate_converters.md

File metadata and controls

100 lines (84 loc) · 3.37 KB
title page_title description slug tags published position
Coordinate Converters
Coordinate Converters
This article describes the build-in coordinate converters.
radmap-features-coordinate-converters
osgb36converter, epsg900913converter, coordinateconverter, projection, mercator
true
3

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.

[XAML] Example 1: Setting CoordinateConverter property

{{region radmap-features-coordinate-converters_0}} 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> {{endregion}}

Custom Coordinate Converter

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

[C#] Example 2: Implement ICoordinateConverter

{{region cs-radmap-features-coordinate-converters_1}} 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();
	}
}

{{endregion}}

The custom coordinate converter can be assigned to the MapShapeReader.CoordinateConverter property.

[XAML] Example 3: Setting CustomCoordinateConverter in XAML

{{region radmap-features-coordinate-converters_2}} 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> {{endregion}}

See Also

  • [Navigation]({%slug radmap-features-navigation%})
  • [Zoom Modes]({%slug radmap-features-zoom-modes%})
  • [Distance and Scale]({%slug radmap-features-dsitance-and-scale%})
  • [Mouse Location]({%slug radmap-features-mouse-location%})
  • [Default Layout]({%slug radmap-features-default-layout%})