/// <summary> /// Spatial query using DotSpatial /// </summary> /// <param name="featureSet">FeatureSet</param> /// <param name="geometry">Spatial geometry</param> /// <returns>Selected features</returns> public static IFeatureSet SpatialQuery(IFeatureSet featureSet, IGeometry geometry) { List <IFeature> features = new List <IFeature>(); for (int i = 0; i < featureSet.Features.Count; i++) { if (RelateOp.Relate(featureSet.Features[i].Geometry, geometry).IsIntersects()) { features.Add(featureSet.Features[i]); } } FeatureSet result = new FeatureSet(features); result.Projection = CloneableEM.Copy(featureSet.Projection); result.InvalidateEnvelope(); // the new set will likely have a different envelope bounds return(result); }