Created
October 1, 2015 08:52
-
-
Save bertt/eb945b20661f26498477 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.Data.Spatial code sample for .NET 4.5/4.6 | |
Add a reference to System.Data.Entity | |
var geom1 = DbGeometry.PolygonFromText("POLYGON((1 1,5 1,5 5,1 5,1 1),(2 2, 3 2, 3 3, 2 3,2 2))",4326); | |
var geom2 = DbGeometry.LineFromText("LINESTRING(3 4,10 50,20 25)", 4326); | |
var geom3 = geom2.Buffer(1); | |
if (geom1.Overlaps(geom3)){ | |
var geom4 = geom1.Difference(geom3); | |
Console.WriteLine("geom4: " + geom4.AsText()); | |
Console.WriteLine("area: " + geom4.Area); | |
} | |
Console.WriteLine(geom1.Intersects(geom2)); | |
Console.WriteLine(geom3.AsText()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment