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

Intersection Query After Zoom-in

Topics: General Topics
Oct 2, 2006 at 7:17 PM
I take a mouse click, expand it by a given tolerance, transform it to World coordinates and then execute an InteresectionQuery (the target layer is a point type). This works at a zoom-all level. However, if I zoom in it no longer returns any records. The code is attached:

private BoundingBox pixelToGeoEnvelope(int x, int y)
// Todo - the tolerance of the ID should be configurable.
int tolerance = 5;

// Expand the pixel box by the tolerance.
int x1 = x - tolerance;
int y1 = y - tolerance;
int x2 = x + tolerance;
int y2 = y + tolerance;

// Create a World box from the Image box.
SharpMap.Geometries.Point p1 = ImageToWorld(new PointF(x1, y1));
SharpMap.Geometries.Point p2 = ImageToWorld(new PointF(x2, y2));
return new BoundingBox(p1, p2);

// I do something like this:
BoundingBox bbox = pixelToGeoEnvelope(pixelX, pixelY);
FeatureDataSet fds = new FeatureDataSet();
layer.DataSource.ExecuteIntersectionQuery(bbox, fds);

I zoom in simply by setting the Zoom property.

Any ideas?

Oct 3, 2006 at 9:40 PM

What type of datasource are you querying?

Oct 4, 2006 at 1:52 PM
It's an MsSql point datasource.