Hello ThinkGeo People,
Here is a good question...I think. What is the quickest way from a sql search to getting the bounding box on a feature. I am doing this currently on a large database so it is fast to do the SQL search but slow to return the Feature. I am sure there is a faster way to do this but not totally sure what that is. Here is an example of what I am doing:
DataTable dataTable = worldLayer.QueryTools.ExecuteQuery("Select * From");
worldLayer.Close();
List<DataRow> list = dataTable.AsEnumerable().ToList();
var staticOverlay = (LayerOverlay)Map1.CustomOverlays["StaticOverlay"];
var spatialQueryResultLayer = (InMemoryFeatureLayer)staticOverlay.Layers["SpatialQueryResultLayer"];
worldLayer.FeatureSource.Open();
Collection<Feature> spatialQueryResults = worldLayer.QueryTools.GetFeaturesByColumnValue("LABEL", list.ElementAt(0).ItemArray.ElementAt(4).ToString());
worldLayer.FeatureSource.Close();
spatialQueryResultLayer.InternalFeatures.Clear();
spatialQueryResultLayer.Open();
foreach (Feature feature in spatialQueryResults)
{
spatialQueryResultLayer.InternalFeatures.Add(feature.Id, feature);
}
spatialQueryResultLayer.Close();
staticOverlay.Redraw();
if (spatialQueryResultLayer.InternalFeatures.Count > 0)
{
spatialQueryResultLayer.Open();
Map1.CurrentExtent = spatialQueryResultLayer.GetBoundingBox();
spatialQueryResultLayer.Close();
Thanks in advance for your input!
Kev