[gdal-dev] OSGeo.OGR.Geometry: Union the mutiple geometries at a time

Even Rouault even.rouault at spatialys.com
Thu Mar 18 04:08:59 PDT 2021


Rajesh,

Use geom_collection.UnionCascaded() where geom_collection is a 
GeometryCollection / MultiPolygon of your many polygons. See 
https://github.com/OSGeo/gdal/blob/5fcc5dd5995af063065c253387bd9c767aeb8130/autotest/ogr/ogr_geos.py#L336

Even

Le 18/03/2021 à 06:01, MRRAJESH a écrit :
> Developers,
>
> We came to know that OSGeo.OGR.Geometry is having the *Union *method which
> allows to the union of the two geometries (code snippet below). But this
> allows us one by one. How to union the multiple geometries (say 1000
> geometries) at a time? Any methods or libraries in GDAL?
>
> OSGeo.OGR.Geometry g1 = OSGeo.OGR.Geometry.CreateFromWkt("POLYGON(......
> OSGeo.OGR.Geometry g2 = OSGeo.OGR.Geometry.CreateFromWkt("POLYGON(......
> OSGeo.OGR.Geometry g3 = OSGeo.OGR.Geometry.CreateFromWkt("POLYGON(......
>
> OSGeo.OGR.Geometry unionGeometry = (g1.Union(g2)).Union(g3);
>
> Regards,
> Rajesh
>
>
>
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list