luni, 25 august 2014

Identify feature DotSpatial Map

Map

Identify feature DotSpatial Map on MouseUP event.


private void map1_MouseUp(object sender, MouseEventArgs e)
{
      Coordinate cor =  map1.PixelToProj(e.Location);
      Extent ex = new Extent(cor.X, cor.Y, cor.X, cor.Y);
      var  mLayer = map1.Layers[0];
      IFeatureLayer il = (IFeatureLayer) mLayer;
      List<IFeature> result = il.DataSet.Select(ex);
      if (result.Count>0)  
      {
           IFeature ift = result.FirstOrDefault();
           MessageBox.Show(ift.DataRow[0].ToString()); 
       }
}

Un comentariu:

  1. do you have any idea about point shape file? Because I test this code for point shape and image layer but dont work. can u help me?

    RăspundețiȘtergere