This project has moved and is read-only. For the latest updates, please go here.

How to show polygon details while clicking on Image

Topics: General Topics
Apr 22, 2008 at 12:28 PM
I am showing a shape file on a web form which and shape file contail a column named gridNo , now i want to konw the specific gridNo when user click on any polygon of the Image but HOW............ :(

Apr 23, 2008 at 12:29 PM
Edited Apr 23, 2008 at 12:44 PM

first of all I wants to know which Map controll you are using...either simple ImageButton or AjaxMap Control...because code for ImageButton is somthing like....

//...On Imagebutton click........!!!
SharpMap.Geometries.Point clickPoint = myMap.ImageToWorld(new PointF(e.X, e.Y));

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

// open DataSource


// retrieve information from clicked point...this method fill dataset

((SharpMap.Layers.VectorLayer)myMap.Layers0).DataSource.ExecuteIntersectionQuery(clickPoint.GetBoundingBox(), ds);

// close datasource


if (ds.Tables.Count > 0)
System.Text.StringBuilder str = new System.Text.StringBuilder();
//System.Text.StringBuilder strds = new System.Text.StringBuilder();
DataTable dt = ds.Tables0;
foreach (DataRow r in dt.Rows)

GridView1.DataSource = ds.Tables0;