Identifying "long and narrow" polygons in with PostGIS

Instead of area/perimeter, it is better to use the area divided by the square of the perimeter (or its inverse).

This is also called "shape index". The square of the perimeter divided by the area has a minimum value of 4*Pi() (in the case of a disk, which is the most compact 2D geometry), so it can be normalized by 4*Pi() for an easy interpretation (normalized values close to 1 then mean that you have very compact objects and squares have a values of approximately 1.27).

EDIT: A threshold on the area would be usefull to remove the very small artefacts, which could be compact. Then the shape index would show better contrast. EDIT: in addition to this answer, the use of ST_Snap could help you solve the problem before it occurs.


One option would be to use the ratio of the area of the polygon to the longest line that can be drawn using its extremities. Identifying long narrow polygons.

select * from polygons where ST_Length(ST_LongestLine(geom, geom)) < ST_Area(geom) * 4

This works pretty well for sliver polygons. You can adjust what the ratio (what you multiply the area with) to suit your needs and projection.


I would try to create a negative buffer, if it eats thin polygons, then it’s good, if it doesn’t eat the polygon, then it’s mine ... :-)

run this script, having previously set 2/3 of the width of the linear polygons ...

create table name_table as
SELECT ST_Buffer(
(ST_Dump(
(ST_Union(
ST_Buffer(
(geom),-0.0001))))).geom,
0.0001)) as geom from source_table

OS :-)...