c# - combine several DbGeography polygons -
i looking ways combine several polygons reduce number of points. 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 polygons touch each other, want them combined. disjoint polygons should remain disjoint.
at moment not sure whether union achieves same tsql function stunion().
ps: run stunion in tsql , noticed not produce intended results (i.e. union contains points within combined polygon).
Comments
Post a Comment