Select using Point Feature

Developer
Apr 19, 2013 at 6:35 PM
Hi,

I have a Dotspatial Map control in my application with just 1 layer (polygon) loaded at present.

I would like to query that layer programmatically using an X.Y (point) feature retrieved from a database. Then I would like to highlight the polygon that the point falls within and programmatically zoom the map to that area.

Are there any examples I can learn from?

TIA
Developer
May 22, 2014 at 9:16 AM
Edited May 22, 2014 at 9:16 AM
You can find the feature and zoom to it like this:
 Sub zoomTo(x As Double, y As Double, pFLayer As Dotspatial.Symbology.IFeatureLayer)
        Dim results As List(Of Dotspatial.Data.IFeature) = pFLayer.DataSet.Select(New Point(x, y).Envelope.ToExtent)
        If results.Count > 0 Then Map.ViewExtents = results(0).Envelope.ToExtent
 End Sub