Skip to content

Instantly share code, notes, and snippets.

@bertt
Created February 27, 2018 09:14
Show Gist options
  • Save bertt/452190a661592f9384e8148cc51aaecb to your computer and use it in GitHub Desktop.
Save bertt/452190a661592f9384e8148cc51aaecb to your computer and use it in GitHub Desktop.
Microsoft.Spatial test
using System;
using System.IO;
using Microsoft.Spatial;
namespace TestSpatial2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var operations = new BaseSpatialOperations();
var c = SpatialImplementation.CurrentImplementation;
// SpatialImplementation.CurrentImplementation.Operations = operations;
// SpatialImplementation.CurrentImplementation = new DataServicesSpatialImplementation { Operations = this.implementation };
var formatter = WellKnownTextSqlFormatter.Create(true);
var geom1=formatter.Read<Geometry>(new StringReader("POLYGON((1 1,5 1,5 5,1 5,1 1),(2 2, 3 2, 3 3, 2 3,2 2))"));
var geom2 = formatter.Read<Geometry>(new StringReader("LINESTRING(3 4,10 50,20 25)"));
// no buffer? var geom3 = geom2.Buffer(1);
var intersects = geom1.Intersects(geom2);
//error: "no operations are defined"
Console.WriteLine($"intersects: {intersects}");
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment