Is there any way of merging non contiguous polygons using the SDO_AGGR_UNION or a similar dissolve function?

When i run the below query in oracle sql developer i managed to convert geometry type from polygon(2003) to multipolygon(2007), but in a gis system some polygons are not included on preview.

select shape from ( select nationalcode as nt,SDO_AGGR_UNION(SDOAGGRTYPE(shape, 0.5)) as shape from auadmunits where nationalcode = '1225' group by nationalcode) ;

I know that union is for adjacent shapes, but i am wondering if anyone else has faced this issue and has found an approach, not only handling oracle spatial.


I don't understand your question. When you merge multiple geometries together (using SDO_AGGR_UNION) those that touch or overlap are merged into one element. Those that are disjoint become separate elements.

You need to clarify what exactly you are trying to achieve and what you expect as result.

  • How i can merged polygons that are neither touched nor overlapped? As i can understand the SDO_AGGR_UNION is only for polygons that belong to the above two categories, or i am wrong? For example if there are 2 polygons, the first to east and the second to west, they have a common attribute field and i want to merge their geometries the SDO_AGGR_UNION is appropriate function for this task? Thanks in advance – dimgalas Apr 2 '14 at 8:12
  • Yes, union will work for that too. When it is used to merge N disjoint polygons, then the result will be a multi-polygon with N elements. – Albert Godfrind Apr 10 '14 at 7:31
  • 1
    For best performance, make sure to use Oracle Database 12c and make sure to enable the vector performance accelerator. – Albert Godfrind Apr 10 '14 at 7:33
  • Thank you for your response, i achieved the merge after i test some polygons, touched and disjoint too. Database is 11g and searching on web i didn't find any solution on this issue. The only known thing is written is sdo_aggr_union poor perfomance... – dimgalas Apr 14 '14 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.