This project has moved. For the latest updates, please go here.

ShapeFile - features containing point

Topics: SharpMap v0.9 / v1.x
Mar 7, 2013 at 8:36 AM
Edited Mar 7, 2013 at 8:37 AM
Having a ShapeFile loaded into SharpMap.Data.Providers.ShapeFile what is the best way to solve the following problem.

I have a list of geographic coordinates (points):
POINT(x1, y1)
POINT(x2, y2)
POINT(x3, y3)

The shape file contains some administrative boundaries of counties (polygons).
I need to get a distinct list of the counties those points belong to.

The first thing that comes to my mind is to iterate through all points and call:
sf = new SharpMap.Data.Providers.ShapeFile(sPath);
FeatureDataSet ds2 = new FeatureDataSet();
sf.ExecuteIntersectionQuery(SharpMap.Geometries.Geometry.GeomFromText("POINT(x1, y1)", ds2));
sf.ExecuteIntersectionQuery(SharpMap.Geometries.Geometry.GeomFromText("POINT(x3, y3)", ds2));
Is there another more ellegant way? Filtering maybe?

Thank you.