[OSGeo Africa] Question on PostGIS

Glenn Mullett GMullett at lidwala.com
Fri Mar 14 08:54:34 PDT 2014


Hi Charles

To explode geomteries, you can use st_dump

e.g.

select
    gid,
    st_geometrytype(the_geom) as orig_geom_type,
    st_nrings(the_geom) as orig_geom_number_rings,
    st_geometrytype((st_dump(the_geom)).geom) as dumped_geom_type,
    (st_dump(the_geom)).path as dumped_geom_ordinal_num,
    (st_dump(the_geom)).geom as dumped_geom,
    main_place
from static_main_place
order by 1,5

(see my pic below with some comments and the result...)

[st_dump_example]






Kind regards,
Glenn Mullett
H.O.D. GIS [MSc GIS, Btech Nat. Cons.]
Lidwala Consulting Engineers

________________________________
[Lidwala]P.O. Box 2930, Nelspruit, 1200
Tel: 0861 LIDWALA / 0861 543 9252
Fax: 086 766 2829
Cell: 082 922 3831
Website: www.lidwala.com
Mailto: gmullett at lidwala.com<mailto:mgmullett at lidwala.com>
________________________________
[Think before you print!]
________________________________
Lidwala Consulting Engineers (SA) (Pty) Ltd email Disclaimer and confidentiality note:
 This e-mail, its attachments and any rights attaching hereto are, unless the content clearly indicates otherwise, the property of Lidwala Consulting Engineers (SA) (Pty) Ltd and its subsidiaries. It is confidential, private and intended for only the addressee.  Should you not be the addressee and receive this e-mail by mistake, kindly notify the sender, and delete this e-mail immediately. Do not disclose or use it in any way. Views and opinions expressed in this e-mail are those of the sender unless clearly stated as  those of Lidwala Consulting Engineers (SA) (Pty) Ltd.  Lidwala Consulting Engineers (SA) (Pty) Ltd accepts no liability for any loss or damages howsoever incurred, or suffered, resulting or arising, from the use of this email or its attachments.  Lidwala Consulting Engineers (SA) (Pty) Ltd does not warrant the integrity of this e-mail nor that it is free of errors, viruses, interception or interference.
________________________________

On 14/03/14 17:04, Charles Rethman wrote:
Hello PostGIS experts out there, I have a technical question for you all...

I need to effect 'clips' in PostGIS and I have tried using ST_Difference. I got very messy outputs and then I read in the PostGis Manual the the function doesn't work with Collections. In importing my shape file data into PostGIS, I created multi-polygon geometries--so I presume that is why the ST_Difference function won't give me sensible results.

Is there a function or a way in PostGIS of converting multi-polygons into single polygons (a kind of 'explode' function) so that I don't have to re-import all my shape files (I really HATE those old shape files!)

I am using PostGIS 2.1 on postgres 9.3...

Thank you for your time,

Charles Rethman
Director, Cape Town Office

Cell: +27 71 6735502
Tel: +27 21 6861510
Skype: cwrethman
PO Box 23507, Claremont, 7735, South Africa
19 Sans Souci Road, Newlands, 7700, Cape Town


[X]<http://www.wahenga.co.za>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/africa/attachments/20140314/a7cf8076/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: st_dump.png
Type: image/png
Size: 103622 bytes
Desc: st_dump.png
URL: <http://lists.osgeo.org/pipermail/africa/attachments/20140314/a7cf8076/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lidwala.jpg
Type: image/jpeg
Size: 20145 bytes
Desc: lidwala.jpg
URL: <http://lists.osgeo.org/pipermail/africa/attachments/20140314/a7cf8076/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thinkbeforeprint.jpg
Type: image/jpeg
Size: 1783 bytes
Desc: thinkbeforeprint.jpg
URL: <http://lists.osgeo.org/pipermail/africa/attachments/20140314/a7cf8076/attachment-0003.jpg>


More information about the Africa mailing list