Selecting a Feature and return it's FID or other fields to code for further processing - HELP NEEDED!

May 9, 2011 at 9:37 AM

I am developing a custom GIS application using MapWindow in .net framework C#.

I have been able to link up everything including map, toolstrip, statusbar etc. Everything works as expected when I run the program and load my shape file to the map.

My shape file has fields like FID, longitude, latitude, address, name, population etc.

My challenge now is to read this data everytime I click on a particular feature in that shape.

I have tried an event of the map control: map1_SelectionChanged(object sender, EventArgs e) but this does not return the item or feature selected.

Any help o this will be greatly appreciated.

_________________________

In case you don't understand the picture, I will rephrase it here:

I am trying to read the attributes of features whenever I click on them (by code in C# or VB). Here is my code:

private void map1_SelectionChanged(object sender, EventArgs e)

{

MapWindow.Data.IFeature feat =

map1.GetFeatureLayers()[0].DataSet.GetFeature(index)

}

the problem is that the eventArgs - e, does not give me the selected index of the feature that was clicked upon. If I change the value of 'index' above to a number, say 21, I actually get the feature with index of 21 and from them I could get the recordset to display on a form; which is really what I am interested in. PLZ help. I am stuck.

Sep 2, 2011 at 9:17 PM

I have run into this same question.  I would like to modify the data entry form so I can add validations and other functions to the data input page - but I'm not exactly sure how to capture an ID number off the feature I have identified on the map.  Any suggestions?

Sep 3, 2011 at 3:17 PM
Edited Sep 3, 2011 at 3:19 PM

I have run into this same question。please  help 。

Another method ,use then MapFunctionIdentify how to  get the Selecting a Feature's   FID? 

For example, I have only one layer, when I select a Feature, how to get the value of the FID of the Feature.

 

PLZ help. I am stuck.

Oct 12, 2011 at 11:57 PM

Hi.

I needed something like that and I have found the solution sent by itmicro:

http://dotspatial.codeplex.com/discussions/271675 

Hope it helps!

Regards,

Evemar