For my windows application, I am looking for a method to edit vertexes and geometry of features that are stored in a SQL Server database. I just want a simple function for dividing polygons into 3 parts and so on. Are there any open source library for these functions?


For C# NetTopologySuite is a great option. It's one of the children of the JavaTopologySuite, father of GEOS, Shapely, JSTS, ffi-geos... and maybe Thorin too.

I haven't tested on a real SQL Server database, but you could use it like this:

MsSql2008GeometryReader geometryReader = new MsSql2008GeometryReader();
MsSql2008GeometryWriter geometryWriter = new MsSql2008GeometryWriter();
using (SqlConnection con = new SqlConnection(@"Data Source=localhost;Initial Catalog=Northwind; Integrated Security=True"))
    using (SqlCommand command = new SqlCommand("SELECT * FROM MY_SPATIAL_TABLE", con))
    using (SqlDataReader dataReader = command.ExecuteReader())
        while (dataReader.Read())
            IGeometry geom = geometryReader.Read((byte[])dataReader["my_geometry_field"]);
            geom.Coordinates[0].X = 1;
            geom.Coordinates[0].Y = 1;

            byte[] outputMsSqlGeom = geometryWriter.Write(geom);

Boost.Geometry is probably the best choice if you were looking for C++ library:


For C# I know you can use GDAL:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.