[postgis-users] Removing tiny polygons

Mike Toews mwtoews at gmail.com
Mon Jan 27 12:48:42 PST 2014


On 28 January 2014 09:29, Tom McCallum <termcc at googlemail.com> wrote:
> Ok, really silly question now, how can a polygon field contain what looks
> like multiple polygons.
>
> So I have a Shapefile of GB but its only got 3 polygons in, according to
> PostGis, but there are lots of small island polygons as well which are not
> attached to any of the main land masses, so I don't see how they can all be
> one polygon?  Can a polygon field have multiple polygons in without being a
> multi-polygon?

It's probably a MultiPolygon. However, it is possible to have a
regular Polygon of the ocean surrounding GB, with many internal rings
for each island. See Well-known text [1] to get an idea of how these
things are actually stored. Furthermore, you can query to see the
geometry type using GeometryType [2].

If you have a MultiPolygon, you can split it into several regular
polygons with ST_Dump.

-Mike

[1] https://en.wikipedia.org/wiki/Well-known_text
[2] http://postgis.net/docs/GeometryType.html
[3] http://postgis.net/docs/ST_Dump.html


More information about the postgis-users mailing list