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

Problem using SQLGeospatialDataReader & InformationLayer.GetBestView

1 Answer 53 Views
Map
This is a migrated thread and some comments may be shown as answers.
Brent
Top achievements
Rank 1
Brent asked on 14 Dec 2011, 01:30 PM
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);

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 19 Dec 2011, 08:24 AM
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 >>

Tags
Map
Asked by
Brent
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or