retrieving attribute table

Topics: SharpMap Project
Feb 26, 2007 at 1:37 PM
Hello
i'ld like to have a software which use sharpmap and that displays information about where the user click in the map.
In order to achieve this i don't know which code i must use.I have a file shp which is displayed on the map according the following code

private void test(object sender, EventArgs e)
{
//Set center of the map to where the client clicked
//MessageBox.Show(e.ToString());
String buffer;
SharpMap.Geometries.Point p1 = SharpMap.Utilities.Transform.MapToWorld(new System.Drawing.Point(MousePosition.X, MousePosition.Y), myMap);
SharpMap.Geometries.Point p2 = SharpMap.Utilities.Transform.MapToWorld(new System.Drawing.Point(MousePosition.X100, MousePosition.Y100), myMap);

SharpMap.Geometries.BoundingBox clickBBox = new SharpMap.Geometries.BoundingBox(p1, p2);


SharpMap.Data.FeatureDataSet fds = new SharpMap.Data.FeatureDataSet();
//myLayer.SRID = 41017;
myLayer.DataSource.Open();
myLayer.DataSource.ExecuteIntersectionQuery(clickBBox, fds);
if (fds.Tables.Count > 0) //We have a result i don't know what are the following mnemonics

Thanks for the help
Coordinator
Feb 26, 2007 at 5:23 PM
Not sure I understand. Are you looking what to do with the resulting feature data set?

You can loop through the features after this...

foreach(FeatureDataRow feature in fds.Tables.Rows)
{
System.Diagnostics.Debug.WriteLine(feature"attribute_name");
....
}
Feb 27, 2007 at 7:57 AM
The purpose of this software is only for discovery purpose. However, the instruction set fds.tables.rows doesn't exist in the sharpmap engine

thanks for the help