New to Telerik UI for WinForms? Start a free 30-day trial
SQL Geospatial Reader
Updated over 6 months ago
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

Using SqlGeospatialDataReader
C#
OpenStreetMapProvider osmProvider = new OpenStreetMapProvider();
this.radMap1.Providers.Add(osmProvider);
MapLayer layer = new MapLayer("Capitals");
this.radMap1.Layers.Add(layer);
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;
}
this.radMap1.Layers["Capitals"].AddRange(elements);
Figure 2: Sample Data Table
