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

How do I get corresponding polygon name or ID for a click point in SHarpMap

Topics: SharpMap Project, SharpMap v0.9 / v1.x, SharpMap v2.0
Sep 20, 2010 at 8:34 PM
Edited Sep 20, 2010 at 8:37 PM

Hi Guys,


Can any one help me on how to get the correponding polygon name/Id for a click point in Sharpmap with shapfile application. Remember I am not interested in converting geometric point to world point but rather I am interested in converting geometric/world point in to corresponding polygon.


Example: if some one clicks inside the USA map he/she should get the USA label/name.




Sep 21, 2010 at 1:02 PM
Edited Sep 21, 2010 at 1:02 PM

Hello tekalasi,

Have you had a look at the WinFormSamples project?

Basically what you have to do is

  • set the QueryLayerIndex to the index of the desired layer,
  • set the ActiveTool to 'Query',
  • click anywhere on the map and you'll get a FeatureDataSet with the table containing your intersecting features.

Hth FObermaier

Oct 8, 2010 at 2:38 AM
Edited Oct 8, 2010 at 2:55 AM

Sorry, I thinks webapplication case.

If web application we can use mouse coordinates in JavaScript are conrolled by event.offsetX and event.offsetY properties.