This is a migrated thread and some comments may be shown as answers.

Error AsyncSqlGeospatialDataReader

3 Answers 81 Views
Map
This is a migrated thread and some comments may be shown as answers.
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
Renier Pretorius asked on 14 Jul 2015, 11:33 AM

Hi,

 

I have successfully used the AsyncSqlGeospatialDataReader to read shape data stored in a geometry column in SQL. I first read the geometry objects into a local collection and then assign that collection to the reader

var readerRail = new Telerik.Windows.Controls.Map.SqlGeospatialDataReader();
readerRail.Source = RailShapes;
readerRail.ToolTipFormat = "{SegmentLabel}";
readerRail.GeospatialPropertyName = "ShapeWKT";
readerRail.PreviewReadCompleted += readerRail_PreviewReadCompleted;
 

However, while this has worked on three previous collections on this specific one I get a "Non-static method requires a target" error. It seems as if some of the shape data must then be an issue but I have no idea where to start looking.

 PS: SQL Management studio can query the data and display it

 

3 Answers, 1 is accepted

Sort by
0
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
answered on 14 Jul 2015, 06:09 PM

Hi,

Please ignore. I found my error. A bit embarrassed for not picking it up before posting. I am merging some database business object with shape data from shapefiles imported into SQL Server. Not all business objects where matched, hence the Geospatial Property of some was null causing the error. 

0
Romell
Top achievements
Rank 1
answered on 25 Jan 2017, 07:44 PM

Hi...

I have a question...in this example how can I add the object called "readerRail" to a new layer and after that to a RadMap control?

Thanks

0
Dinko | Tech Support Engineer
Telerik team
answered on 30 Jan 2017, 09:27 AM
Hi ,

You can create a new InformationLayer in code behind and set its Reader property to the "readerRail" object of type SqlGeospatialDataReader(). Then you can add the InformationLayer to the Items collection of your map.
public MainWindow()
{
    InitializeComponent();
    var readerRail = new Telerik.Windows.Controls.Map.SqlGeospatialDataReader();
    var infLayer = new InformationLayer();
    infLayer.Reader = readerRail;
    this.myMap.Items.Add(infLayer);
}
In addition, you can take a look at the SQL Geospatial Data help article in our documentation where the SqlGeospatialDataReader object is further described.

Regards,
Dinko
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Map
Asked by
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
Romell
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Share this question
or