Does SharpMap have replacements for SQLServer.Types?

Topics: SharpMap v0.9 / v1.x
May 18, 2016 at 3:10 PM
I have a C# WPF solution that currently uses Microsoft.SqLServer.Types (Geometry). Currently, it does not store anything in the database, but I wish to change that (it is desktop now, I want to add mobile). I do not want to have to connect online to a database, I am looking to include the database with the app, and so I am looking at SQLite, and I was pointed to SharpMap by someone else.

I take some metes and bounds, draw a polygon, and calculate the acreage, and display it. I need to replace the following SQLGeometry code with the equivalent in SharpMap…

Begin code…

SqlGeometry geom = GetGeometry(segs);
area = geom.STArea().Value;
System.Drawing.Image img = GetImage(geom, "ft");
    private static SqlGeometry GetGeometry(SurveySegment[] segments)
        SqlGeometryBuilder builder = new SqlGeometryBuilder();
        builder.SetSrid(0); // Don't need an SRID here

        // Walk around the segments
        PointF p = new PointF(0, 0);
        builder.BeginFigure(p.X, p.Y);
        for (int i = 0; i < segments.Length; i++)
            p += segments[i].FromOrigin;
            builder.AddLine(p.X, p.Y);

        // Polygon's end point must be at the origin
        if (p.X != 0 || p.Y != 0)
            builder.AddLine(0, 0);


        // Return Geometry
        return builder.ConstructedGeometry;
PointF[] ps = new PointF[geom.STNumPoints().Value];
SqlGeometry temp = geom.STPointN(i + 1);
SqlGeometry centroid = geom.STCentroid();

End code…

Your “Data provider comparisions”, lists geometrytypes supported = “ALL”, for MSSQL. Where would I find a list of the one to one replacements, for the SQLServer code listed above?

Is there a Visual Studio solution somewhere that can be examined, that shows at least how to get SharpMap set up in the solution? For example, your home page lists four Nuget commands…are they all needed? Is there a working example with SQLite and any SharpMap code?

Why is 2.0 listed in the choices to post in, if it is obsolete. This is the second time that I am trying to post here, I tried a few days ago, selected 2.0 (not knowing it was obsolete (usually the higher version is the one to use)), and my posting never appeared.

Is this the right tool (SharpMap), that I should be looking at to replace the SQLServer code, or , should I be looking elsewhere?

Does SharpMap with in UWP?
May 19, 2016 at 9:53 AM
  • SharpMap does currently not work with UWP
  • SharpMap has a provider (SqlServer2008) that can read SqlGeometries, although SharpMap has NetTopologySuite as geometry backend.
  • SharpMap has a provider that can read and write SpatiaLite databases.
You can clone the whole repository at
There is an Examples folder that has some examples for you to look at.