New to Telerik UI for WinForms? Download free 30-day trial

SQL Geospatial Reader

SqlGeospatialDataReader allows generating map shapes from any IEnumerable instance (for example a row collection) which contains a property with geospatial data in Wkt (Well known text) or Wkb (Well known binary) format. The Source property and the GeospatialPropertyName property are used to specify the IEnumerable instance and the name of the property which contains Geospatial data.

Figure 1: SQL Geospatial Reader

WinForms RadMap SQL Geospatial Reader

Using SqlGeospatialDataReader

OpenStreetMapProvider osmProvider = new OpenStreetMapProvider();
MapLayer layer = new MapLayer("Capitals");

BindingSource source = new BindingSource();
source.DataSource = dt;

SqlGeospatialDataReader datareader = new SqlGeospatialDataReader();
datareader.Source = source;
datareader.GeospatialPropertyName = "Geometry";

List<MapVisualElement> elements = datareader.Read(source, "Geometry", true, null);
foreach (var item in elements)
    item.BorderColor = Color.YellowGreen;


Dim osmProvider As New OpenStreetMapProvider()
Dim layer As New MapLayer("Capitals")
Dim source As New BindingSource()
source.DataSource = dt
Dim datareader As New SqlGeospatialDataReader()
datareader.Source = source
datareader.GeospatialPropertyName = "Geometry"
Dim elements As List(Of MapVisualElement) = datareader.Read(source, "Geometry", True, Nothing)
For Each item As MapVisualElement In elements
    item.BorderColor = Color.YellowGreen

Figure 2: Sample Data Table

WinForms RadMap Sample Data Table

In this article