Hi,
After encountering a few performance issues with the Dynamic Layer, would like some clarification on best practices of using the Dynamic Layer.
The following 2 forum posts are from 2010 - http://www.telerik.com/community/forums/wpf/map/working-with-dynamic-layers-and-mapshapereaders.aspx and http://www.telerik.com/community/forums/wpf/map/radmap-dynamiclayer-performance-problem.aspx
I am currently using the below code to only return those geometries which are in the current extents, rather then dealing with this at a fairly low level, does the Dynamic Layer have any of this functionality included?
Many thanks,
Adnan
After encountering a few performance issues with the Dynamic Layer, would like some clarification on best practices of using the Dynamic Layer.
The following 2 forum posts are from 2010 - http://www.telerik.com/community/forums/wpf/map/working-with-dynamic-layers-and-mapshapereaders.aspx and http://www.telerik.com/community/forums/wpf/map/radmap-dynamiclayer-performance-problem.aspx
I am currently using the below code to only return those geometries which are in the current extents, rather then dealing with this at a fairly low level, does the Dynamic Layer have any of this functionality included?
Many thanks,
Adnan
public
void
ItemsRequest(
object
sender, ItemsRequestEventArgs e)
{
IList<SqlGeometry> geometryList =
new
List<SqlGeometry>();
LocationRect currentRegion =
new
LocationRect(e.UpperLeft, e.LowerRight);
string
sql =
string
.Format(
"SELECT the_geom FROM Locations WHERE the_geom.STIntersects(geometry::STGeomFromText('POLYGON(({0} {1}, {2} {3}, {4} {5}, {6} {7}, {0} {1}))', 0)) = 1 "
, currentRegion.Southwest.Longitude, currentRegion.Southwest.Latitude, currentRegion.Northwest.Longitude, currentRegion.Northwest.Latitude, currentRegion.Northeast.Longitude, currentRegion.Northeast.Latitude, currentRegion.Southeast.Longitude, currentRegion.Southeast.Latitude);
using
(SqlConnection sqlConnection =
new
SqlConnection(connectionString))
{
sqlConnection.Open();
using
(SqlCommand sqlCommand =
new
SqlCommand(geographicalBoundsSQL, sqlConnection))
{
using
(SqlDataReader reader = sqlCommand.ExecuteReader())
{
while
(reader.Read())
{
SqlGeometry sqlGeometry = (SqlGeometry)reader[
"the_geom"
];
geometryList.Add(sqlGeometry);
}
}
}
}