Hello everyone!
I'm using nts 1.12.1. My code looks like that:
public void DoSomething(Envelope extent)
{
IGeometry extentGeom = _geomFactory.ToGeometry(extent);
string wkt = extentGeom.AsText();
SqlGeography sqlGeom = SqlGeography.STGeomFromText(new System.Data.SqlTypes.SqlChars(wkt), 4326); // (*)
}
and in the line (*) I'm getting an exception, because in wkt-string points are ordered in clockwise order, while SqlGeography, according to OGC standard, accepts counter clockwise order.
If I add a line like this:
extentGeom.Normalize();
Parsing from WKT is expensive. Have you tried the SqlGeographyReader/Writer classes?
Anyway, if the coordinate order is expected to be CCW you can do
if (!NetTopologySuite.Algorithms.CGAlgorithms.IsCCW(p.Coordinates))
p = p.Reverse();
--
You received this message because you are subscribed to the Google Groups "NetTopologySuite" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nettopologysuite/-/3FzhBbDsqLQJ.
To post to this group, send email to nettopol...@googlegroups.com.
To unsubscribe from this group, send email to nettopologysui...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nettopologysuite?hl=en.
var envelope = new Envelope(1, 2, 1, 2);
var geom = geomFactory.ToGeometry(envelope);
var wkt = geom.AsText();
wkt = "POLYGON((1 1,2 1,2 2,1 2,1 1))"
wkt = "POLYGON ((1 1, 1 2, 2 2, 2 1, 1 1))"
6.1.11.1
The exterior boundary LinearRing defines the “top” of the surface which is the side of the surface from which the exterior boundary appears to traverse the boundary in a counter clockwise direction. The interior LinearRings will have the opposite orientation, and appear as clockwise when viewed from the “top”
It is confused slightly by SFS for SQL 1.2.1 (http://www.opengeospatial.org/standards/sfs) stating that orientation has no bearing on validity as long as shells and holes are in opposite directions.
To view this discussion on the web visit https://groups.google.com/d/msg/nettopologysuite/-/GhYXQNGcl8EJ.