Problem with ExecuteIntersectionQuery

Topics: Algorithms, General Topics, SharpMap v0.9 / v1.x, WinForms Controls
Sep 27, 2010 at 12:44 PM

Hi!
I use ShaprMap v0.9.
I have 2 layers:
1) Raster (bmp)
2) Vector (shape)
I want to find which raster point vector polygone includes.

My bmp+shape:
see image 1

I checked every bmp's point with "ExecuteIntersectionQuery" operator.
But in result image i've seen not only internal points:
see image 2

Points are near the polygone!

// in loop
p1.X = mapImage.Map.ImageToWorld(pf).X;
p1.Y = mapImage.Map.ImageToWorld(pf).Y;
FeatureDataSet ds = new FeatureDataSet();
shapeLayer.DataSource.ExecuteIntersectionQuery(p1.GetBoundingBox(), ds);
if (ds.Tables[0].Rows[0].ItemArray[1].ToString() == "25")
{bmp.SetPixel(i, j, Color.Red);}

Is it SharpMap or OGR bug?
Help me to understand, please.

Sep 27, 2010 at 12:48 PM

I can write all my code if it's required.

Coordinator
Sep 27, 2010 at 2:00 PM

Hello ego2,

I don't quite understand what you want to achieve but you need to make sure. that the point you are querying for is within the polygon.

To do that you need to do true geometry intersection testing with NetTopologySuite (NTS).

Hth FObermaier

Sep 29, 2010 at 2:22 PM
Edited Sep 29, 2010 at 2:23 PM

Thanks for your help, FObermaier! works perfectly