Thursday 29 October 2015

qgis - Identifying "long and narrow" polygons in with PostGIS



I have a set of polygons representing large areas, say city neighborhoods. I want to identify the large overlapping areas between them.


But there's a problem: sometimes these polygons will overlap along their perimeters (because they were drawn with little precision). This will generate long and narrow overlaps that I do not care about.


But other times there will be big overlaps of robust polygons, meaning large areas where a neighborhood's polygon overlaps another. I want to select only these.


See the picture below of just the overlaps. Imagine I wanted to select only the blue polygon in the lower left corner.


overlap


I could look at areas, but sometimes the narrow ones are so long they end up having areas as large as the blue polygon. I've tried to do a ratio of area / perimeter, but that has also yielded mixed results.


I've even tried using ST_MinimumClearance, but sometimes the large areas will have a narrow part attached to it, or two very close vertices.


Any ideas of other approaches?




In the end what worked best for me was using a negative buffer, as suggested by @Cyril and @FGreg below.



I used something like:


ST_Area(ST_Buffer(geom, -10)) as neg_buffer_area

In my case, units were meters, so 10 m negative buffer.


For narrow polygons, this area returned zero (also, the geometry would be empty). Then I used this column to filter out the narrow polygons.



Answer



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 :-)...


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...