Error AsyncSqlGeospatialDataReader

4 posts, 0 answers
  1. Renier Pretorius
    Renier Pretorius avatar
    49 posts
    Member since:
    Apr 2010

    Posted 14 Jul 2015 Link to this post

    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

     

  2. Renier Pretorius
    Renier Pretorius avatar
    49 posts
    Member since:
    Apr 2010

    Posted 14 Jul 2015 in reply to Renier Pretorius Link to this post

    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. 

  3. Romell
    Romell avatar
    39 posts
    Member since:
    Feb 2012

    Posted 25 Jan in reply to Renier Pretorius Link to this post

    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

  4. Dinko
    Admin
    Dinko avatar
    285 posts

    Posted 30 Jan Link to this post

    Hi Romell,

    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 allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top