[postgis-users] get parts of polygons with less than 0.5 meters of free width

Nicolas Ribot nicolas.ribot at gmail.com
Sat Jul 13 03:50:23 PDT 2013

```Hi,

If sidewalks are narrow polygons, you could try to extract the two
edges of the sidewalks by removing polygons ends.
Based on these linestrings (2 per sidewalk), you can test the distance
between the furniture and the edges and determine which sidewalks are
wide enough:

In this example, I cheated as I removed sidewalks ends by hand. There
should be a way to do the same based on the geometry shape.

furn table contains furniture polygons (identifier: pgid)
side_seg2 table contains sidewalks sides as linestrings.
side table contains original sidewalks polygons.

To match sidewalks wide enough, you can compute the distance between
furniture and each edge of the sidewalk:

select distinct s.pgid
from side_seg2  s, furn f, side
where s.pgid = side.id
and st_distance(s.geom, f.geom) >  55
and st_contains(side.geom, f.geom);

pgid
------
D

To match narrow sidewalks, you can negate the previous query or
compute the sidewalks for which both edges are too close from
furnitures:

select s.pgid
from side_seg2  s, furn f, side
where s.pgid = side.id
and st_distance(s.geom, f.geom) <  55
and st_contains(side.geom, f.geom)
group by s.pgid, f.id having count(s.pgid) = 2;

pgid
------
A
B

In my example, the threshold distance is 55 m instead of 0.5 meters
(see attached image). Do you have a dataset you could share to see if
it is possible to transform sidewalks polygons into edges linestrings
?

Nicolas

On 8 July 2013 16:43, Lito Macieira <litomacieira2 at gmail.com> wrote:
> Hi guys,
>
> I have two tables of simple polygons that are sidewalks and furniture.
> I want find the regions where the sidewalks have less than 0.5 meters of
>
> free width like in image [ss2].
> I don't want when at least one side have more than 0.5 meters [ss1].
> I've tried many things with ST_LINE_INTERPOLATE_POINT,converting
> polygons to lines, but i can't detect this parts of sidewalks.
>
> Can anybody help me with that?
>
> thanks
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: img1.png
Type: image/png
Size: 65617 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130713/1c6b1b56/attachment.png>
```