ExecuteIntersectionQuery(SharpMap.Geometries.boundingRectangle,FeatureDataSet) returns empty dataset

Oct 24, 2009 at 8:15 AM

Hi, I am a newbie.

I only recently found what Sharpmap can do for me. believe me its a great product!

I have one tiny problem though and I have only a little time to spare. I am using SharpMap build 0.0.9.

My code look like this:

 

Point bottomLeftPoint = new Point(e.X - 10,e.Y -10);

Point upperRightPoint = new Point(e.x = 10, e.Y + 10);

SharpMap.Geometries.Point bottomLeftWorldPoint = map.ImageToWorld((bottomLeftPoint);

 SharpMap.Geometries.Point upperRightWorldPoint = map.ImageToWorld((upperRightPoint);

 SharpMap.Geometries.BoundingBox bb =new SharpMap.Geometries.BoundingBox(worldBottomLeftPoint,worldUpperRightPoint);

SharpMap.Data.FeatureDataSet fds =new  SharpMap.Data.FeatureDataSet();

foreach(SharpMap.Layers.Vectorlayer layer in map.Layers)

{

if( !layer.DataSource.IsOpen) layer.DataSource.Open();

layer.dataSource.ExecuteIntersectionQuery(bb,fds);

}

 

There are many layers on the map, but not one of them returns any data.

When I went through the source code provided I found that the data gets loaded into the FeatureDataTable but when it's added to the FeaturedataSet, the FeatureDataSet doesn't show any data.

As such I am unable to retrieve any data and hence can't get my application  to work!

Please help as I don't have much time on my hands. the Boundingrectangle is correct because it can fetch data into the table but the dataset being returned doesn't contain the table containing the data.

Is this a bug? Or have I missed out on something.

Oct 24, 2009 at 8:33 AM

Ok, I am sorry. the data has been picked up.. My mistake sorry. but I have run into a new problem!

I can't iterate throught the rows in the Featuredatatable. Says this feature is not supported. i need help with iterating through all the faetures in the table.

 

Thanks in advance.

Shishir

Oct 24, 2009 at 9:49 AM

Guys i am too sorry this time. I got it. I had to typecast FeaturedataTable to System.Data.DataTable and my problem is solved. but thanks anyway.

Cheers to SharpMap!

Shishir