Concatenate Multiple DbGeography Polygons

I am looking for ways to combine multiple polygons to reduce the number of points. Will this be the way forward:

var pol1 = DbGeography.PolygonFromText("POLYGON ((-2.91790532309701 53.3657440952224, -2.91790532309701 53.3567508791632, -2.90283703655041 53.3567508791632, -2.9028338560513 53.3657440952224, -2.91790532309701 53.3657440952224))", 4326);
var pol2 = DbGeography.PolygonFromText("POLYGON ((-2.90283703655041 53.3657440952224, -2.90283703655041 53.3567508791632, -2.88776875000381 53.3567508791632, -2.88776556950469 53.3657440952224, -2.90283703655041 53.3657440952224))", 4326);
var pol3 = DbGeography.PolygonFromText("POLYGON ((-2.91641048851245 53.3747373112816, -2.91641048851245 53.3657440952224, -2.90133902146673 53.3657440952224, -2.90133583925323 53.3747373112816, -2.91641048851245 53.3747373112816))", 4326);

var combined = (pol1.Union(pol2)).Union(pol3);

      

Basically, if the polygons touch each other, I want them to be merged. Non-intersecting polygons must remain non-intersecting.

At the moment I'm not sure if Union achieves the same as TSQL's STUnion () function.

PS: I just run STUnion in TSQL and noticed that it also doesn't give the expected results (i.e. the union contains points in the combined polygon).

+3


source to share





All Articles