Bill,<br><br>Either of OGRGeometry::Union() and OGRGeometry::UnionCascaded() should help you.<br><br>I would choose the latter if there are more than two polygons. It operates on an OGRMultiPolygon object.<br><br><div class="gmail_quote">
On Tue, Apr 5, 2011 at 2:35 AM, Cassanova, Bill <span dir="ltr"><<a href="mailto:BCassanova@weather.com">BCassanova@weather.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal">Hi All,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I am looking for some direction on if GDAL has the capability has the ability to build a super-polygon from a series of small polygons…I have played a bit with the OGR Geometry classes but I can’t</p>
<p class="MsoNormal">seem to quite get what I need.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Let’s start with a simply example.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Polygon A has vertices in (X,Y) format of <0, 0>, < 0,1>, <1,0>, <1,1></p>
<p class="MsoNormal">Polygon B has vertices in (x,y) format of < 1,0 >, <1,1>, <2,0>, <2,1></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Since Polygon A and B share a common side with vertices < <1,0> and <1,1> I want to build super polygon that contains the coordinates of the outer perimeter of the points.</p>
<p class="MsoNormal">When complete the new polygon C will thus have points <0,0>,<0,1>,<2,0>, <2,1></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I had first looked at OGRPolygon.AddRing wherein A and B above would be OGRLinearRings and then by making a call to C.getExteriorRing() but this seem to report the first ring added.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Am I heading in the correct direction or is this something that I will essentially have to do manually by first creating a OGRLinearRing from the vertices of polygon A, then creating a OGRPolygon to which I execute addRing.</p>
<p class="MsoNormal">Then interrogating that ring to see which line segments are common between A and B and removing the ones that are common and adding the line segments that aren’t common.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks,</p>
<p class="MsoNormal">Bill</p>
<p class="MsoNormal"><span style="font-size: 9pt;">++++</span></p>
<p class="MsoNormal"><span style="font-size: 9pt;"> </span></p>
<p class="MsoNormal"><span style="font-size: 9pt;">William Cassanova | Senior GFS Developer | The Weather Channel | 770.226.2368 | <a href="mailto:bcassanova@weather.com" target="_blank">bcassanova@weather.com</a></span></p>
<p class="MsoNormal"> </p>
</div>
</div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>
/tʃaɪθənjə/ /kʊmɑr/ <br>+91-9494447584<br>17.2416N 80.1426E<br>