Problem using SQLGeospatialDataReader & InformationLayer.GetBestView

2 posts, 0 answers
  1. Brent
    Brent avatar
    7 posts
    Member since:
    Feb 2011

    Posted 14 Dec 2011 Link to this post

    If I use SQLGeospatialDataReader to populate my InformationLayer with data, the InformationLayer.GetBestView method does not work.

    Even though I can see data from my InformationLayer on the map, when I debug, InformationLayer.Items is empty (has Count = 0). So when InformationLayer.Items gets passed to GetBestView method, the result is wrong.

    Please help.

    Here is a code snippet to illustrate.

    private InformationLayer informationLayer = new InformationLayer();     
    public InformationLayer IL
                    return informationLayer;
                    informationLayer = value;
    public SqlGeospatialDataReader SQLR = new SqlGeospatialDataReader();
    //Use SQLR to read geospatial data from SQL Server
    IL.Reader = SQLR;
    LocationRect BestViewRect = IL.GetBestView(IL.Items);
  2. Andrey
    Andrey avatar
    1681 posts

    Posted 19 Dec 2011 Link to this post

    Hi Brent,

    The SQLGeospatialDataReader reads data asynchronously. So, to avoid a problem with incorrect "Best View" calculation you should handle the SQLGeospatialDataReader.ReadCompleted event which occurs when the reading complete and when the read shapes are already added to the information layer.

    Kind regards,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top