public void TestSTRelateWithBoundaryRule() { using (var db = new PostGisTestDataConnection(TestDatabaseConnectionString)) { const string geom1 = "POINT(1 2)"; const string geom2 = "POINT(3 4)"; var result1 = db.Select ( () => GeometryInput .STGeomFromText(geom1) .STRelate(GeometryInput.STGeomFromText(geom2), 1) ); var result2 = db.Select ( () => GeometryInput .STGeomFromText(geom1) .STRelate(GeometryInput.STGeomFromText(geom2), 2) ); var result3 = db.Select ( () => GeometryInput .STGeomFromText(geom1) .STRelate(GeometryInput.STGeomFromText(geom2), 3) ); var result4 = db.Select ( () => GeometryInput .STGeomFromText(geom1) .STRelate(GeometryInput.STGeomFromText(geom2), 4) ); var result5 = ( from g1 in db.TestGeometries.Where(g => g.Id == 1).Select(g => g.Geometry) from g2 in db.TestGeometries.Where(g => g.Id == 2).Select(g => g.Geometry) select SpatialRelationships.STRelate(g1, g2, 1) ).FirstOrDefault(); Assert.IsFalse(String.IsNullOrEmpty(result1)); Assert.IsFalse(String.IsNullOrEmpty(result2)); Assert.IsFalse(String.IsNullOrEmpty(result3)); Assert.IsFalse(String.IsNullOrEmpty(result4)); Assert.AreEqual("FF0FFF0F2", result1); Assert.AreEqual("FF0FFF0F2", result2); Assert.AreEqual("FF0FFF0F2", result3); Assert.AreEqual("FF0FFF0F2", result4); Assert.IsTrue(String.IsNullOrEmpty(result5)); } }
public void TestSTRelateDE9IM() { using (var db = new PostGisTestDataConnection(TestDatabaseConnectionString)) { const string Wkt1 = "POINT(1 2)"; const string Wkt2 = "POINT(3 4)"; var result1 = db.Select(() => GeometryInput .STGeomFromText(Wkt1) .STRelate(GeometryInput.STGeomFromText(Wkt2))); Assert.IsFalse(string.IsNullOrEmpty(result1)); var result2 = ( from g1 in db.TestGeometries.Where(g => g.Id == 1).Select(g => g.Geometry) from g2 in db.TestGeometries.Where(g => g.Id == 2).Select(g => g.Geometry) select SpatialRelationships.STRelate(g1, g2) ).FirstOrDefault(); Assert.IsTrue(String.IsNullOrEmpty(result2)); } }