title: SharpMap Selecting Geometry with GeoAPI.Geometries
body: <p>hi there i'm trying to create a function that will select a layers geometry and change its colour or highlight it.</p>
  
  <p>I've found the <code>FindGeoNearPoint</code> function but this deals with the old <code>SharpMap.Geometries</code> whih no longer exists and has been replaced with GeoAPI.Geometries.</p>
  
  <p>How do I alter the <code>FindGeoNearPoint</code> Function to use GeoAPI</p>
  
  <p>Here is my attempt</p>
  
  <pre><code>     public SharpMap.Data.FeatureDataRow FindGeoNearPoint(GeoAPI.Geometries.IPoint pos, SharpMap.Layers.VectorLayer layer, double amountGrow)
      {
  
          GeoAPI.Geometries.Envelope bbox = new GeoAPI.Geometries.Envelope();
          SharpMap.Data.FeatureDataSet ds = new SharpMap.Data.FeatureDataSet();
  
          layer.DataSource.ExecuteIntersectionQuery(bbox, ds);
  
          DataTable tbl = ds.Tables[0] as SharpMap.Data.FeatureDataTable;
  
          NetTopologySuite.IO.WKTReader reader = new NetTopologySuite.IO.WKTReader();
  
          GeoAPI.Geometries.IGeometry point = reader.Read(pos.ToString());
  
          if (tbl.Rows.Count == 0)
  
              return null;
  
  
  
          double distance = point.Distance(reader.Read((tbl.Rows[0] as SharpMap.Data.FeatureDataRow).Geometry.ToString()));
  
          SharpMap.Data.FeatureDataRow selectedFeature = tbl.Rows[0] as SharpMap.Data.FeatureDataRow;
  
  
  
          if (tbl.Rows.Count &gt; 1)
  
              for (int i = 1; i &lt; tbl.Rows.Count; i++)
              {
  
                  GeoAPI.Geometries.IGeometry line = reader.Read((tbl.Rows[i] as SharpMap.Data.FeatureDataRow).Geometry.ToString());
  
                  if (point.Distance(line) &lt; distance)
                  {
  
                      distance = point.Distance(line);
  
                      selectedFeature = tbl.Rows[i] as SharpMap.Data.FeatureDataRow;
  
                  }
  
              }
  
          return selectedFeature;
  
      }
  </code></pre>