[GIS] How to get Geometry points using Geo API

asp.netcsharpmap

I have a EPSG:4326 WGS 84 Shapefile and I've converted it into Sql Spatial Data I'm able to render the map using that with sharpmap 1.1(Previously was using Sharpmap 0.9).
What I'm trying to achieve is when I click on a generated Polygon, the clicked polygon must be filled with a color (For identification purpose) So I'm able to get the point where I click but how to use that point and query for all the point inside that polygon so that I can color all the point which might result in coloring all the polygon.

The problem is I don't know how to do this in sharpmap version 1.1.

Previously when I was using Sharpmap 0.9 I used the below line to get all the points to color whole of the polygon.

pointArray.Collection.Add(SharpMap.Geometries.LinearRing.GeomFromWKB((byte[])Row["the_geom"]));

My Data is from Sql Spatial DB hence the Row["the_geom"].

So far I've done this.(Which highlights only the point and need to add the points into Geo API collection)

Collection<GeoAPI.Geometries.IGeometry> geomColl = new Collection<GeoAPI.Geometries.IGeometry>();
        GeoAPI.GeometryServiceProvider.Instance = new NetTopologySuite.NtsGeometryServices();
        GeoAPI.Geometries.IGeometryFactory gf = GeoAPI.GeometryServiceProvider.Instance.CreateGeometryFactory();


        SharpMap.Layers.VectorLayer mySuggestedLayer = new SharpMap.Layers.VectorLayer("Higlight");
        fillcolor = shapeFillColor;

        var factory = GeoAPI.GeometryServiceProvider.Instance.CreateGeometryFactory(_SRID);
        var pointArraySubject = factory.CreateGeometryCollection(null);
        var mySubjectLayer = new SharpMap.Layers.VectorLayer("SubjectIcon");

        DataRow Row = accounts.NewRow();
        for (int i = 0; i < accounts.Rows.Count; i++)
        {
            Row = accounts.Rows[i];
            GeoAPI.Geometries.Coordinate PinPnt = new GeoAPI.Geometries.Coordinate();


            double x = Double.Parse(Row["Xcoord_geo"].ToString()); 
            double y = Double.Parse(Row["Ycoord_geo"].ToString()); 

            PinPnt.X = x;
            PinPnt.Y = y;

           //pointArray.Collection.Add(SharpMap.Geometries.LinearRing.GeomFromWKB((byte[])Row["the_geom"]));
            geomColl.Add(gf.CreatePoint(PinPnt));

  mySuggestedLayer.DataSource = new SharpMap.Data.Providers.GeometryFeatureProvider(geomColl);


        mySuggestedLayer.Style.Fill = new System.Drawing.SolidBrush(fillcolor);       
        mySuggestedLayer.Style.EnableOutline = true;
        mySuggestedLayer.SRID = _SRID;

        _map.Layers.Add(mySuggestedLayer);

        return _map;

Any idea/help will make my day.

Best Answer

I figured it out myself with some help from FObermaier of Sharpmap discussion is here , I'm posting it so that might help someone.

The problem was with the geometry transformation of the layer It seems the transformation was in wrong format

GeoAPI.Geometries.Coordinate PinPnt = new GeoAPI.Geometries.Coordinate();
 NetTopologySuite.IO.WKBReader reader = new NetTopologySuite.IO.WKBReader();
 var wkb = (byte[])Row["the_geom"];
 Geometry geom = (Geometry)reader.Read(wkb);
 var p = new GeometryFeatureProvider(geom);
 myLayer.DataSource = p;
 myLayer.Style.Fill = new System.Drawing.SolidBrush(fillcolor);
ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory ctFact = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
myLayer.CoordinateTransformation = ctFact.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84, ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator);
myLayer.ReverseCoordinateTransformation = ctFact.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator, ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84);
_map.Layers.Add(myLayer);

In the above

Row["the_geom"]

has layer which needs to be highlighted. Using ProjNet I've transformed the geometry to web mercator and it worked.