[gdal-dev] Building a resizable polygon

Chaitanya kumar CH chaitanya.ch at gmail.com
Mon Apr 4 17:44:21 EDT 2011


Bill,

Either of OGRGeometry::Union() and OGRGeometry::UnionCascaded() should help
you.

I would choose the latter if there are more than two polygons. It operates
on an OGRMultiPolygon object.

On Tue, Apr 5, 2011 at 2:35 AM, Cassanova, Bill <BCassanova at weather.com>wrote:

>  Hi All,
>
>
>
> 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
>
> seem to quite get what I need.
>
>
>
> Let’s start with a simply example.
>
>
>
> Polygon A has vertices in (X,Y) format of <0, 0>, < 0,1>, <1,0>, <1,1>
>
> Polygon B has vertices in (x,y) format of < 1,0 >, <1,1>, <2,0>, <2,1>
>
>
>
> 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.
>
> When complete the new polygon C will thus have points <0,0>,<0,1>,<2,0>,
> <2,1>
>
>
>
> 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.
>
>
>
> 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.
>
> 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.
>
>
>
> Thanks,
>
> Bill
>
> ++++
>
>
>
> William Cassanova | Senior GFS Developer | The Weather Channel |
> 770.226.2368 | bcassanova at weather.com
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
Best regards,
Chaitanya kumar CH.
/tʃaɪθənjə/ /kʊmɑr/
+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110405/a2425d71/attachment-0001.html


More information about the gdal-dev mailing list