Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Map > Problem using SQLGeospatialDataReader & InformationLayer.GetBestView

Not answered Problem using SQLGeospatialDataReader & InformationLayer.GetBestView

Feed from this thread
  • Brent avatar

    Posted on Dec 14, 2011 (permalink)

    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
            {
                get
                {
                    return informationLayer;
                }
                set
                {
                    informationLayer = value;
                }
            }
       
    public SqlGeospatialDataReader SQLR = new SqlGeospatialDataReader();
     
    //Use SQLR to read geospatial data from SQL Server
    ReadSQLGeospatialData();
     
    IL.Reader = SQLR;
       
    LocationRect BestViewRect = IL.GetBestView(IL.Items);

    Reply

  • Andrey Andrey admin's avatar

    Posted on Dec 19, 2011 (permalink)

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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Map > Problem using SQLGeospatialDataReader & InformationLayer.GetBestView