# 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.

> caption Figure 1: SQL Geospatial Reader

![WinForms RadMap SQL Geospatial Reader](https://www.telerik.com/products/winforms/documentation/assets/0c54bcb6f9581888ce3ba191c900294c/map-file-readers-sql-geospatial-reader001.png)

#### 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);
        
```

```VB.NET
Dim osmProvider As New OpenStreetMapProvider()
Me.radMap1.Providers.Add(osmProvider)
Dim layer As New MapLayer("Capitals")
Me.radMap1.Layers.Add(layer)

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
Next

Me.radMap1.Layers("Capitals").AddRange(elements)
```

> caption Figure 2: Sample Data Table

![WinForms RadMap Sample Data Table](https://www.telerik.com/products/winforms/documentation/assets/6dd931b2c2a8d7c5b0a016628da0c50d/map-file-readers-sql-geospatial-reader002.png)
