[postgis-users] Computing the lenght of a building's edges looking on a direction

Rémi Cura remi.cura at gmail.com
Wed Jun 17 09:24:09 PDT 2015


Hm,
quite easy normally (method proposed above won't work).
First break your polygon into segment, for instance with
https://github.com/Remi-C/PPPP_utilities/blob/master/postgis/rc_DumpSegments.sql
Then, for each segment, compute the angle between first and last point,
using ST_Azimuth, and st_pointN.

Now, keep the segment where the abs(angle) is between pi/2
 -tolerancy and pi/2+tolerancy
( you should add a tolerancy , nobody will be facing exactly north)
*.*


*Now simply sum the st_length of found segments.*

*Cheers,*

*Rémi-C*

2015-06-17 17:40 GMT+02:00 Komяpa <me at komzpa.net>:

> Hello,
>
> you can apply ST_ForceRHR, break your polygons into segments and sum
> length of the ones that go from right to left, that is, where
> ST_X(ST_StartPoint(geom)) < ST_X(ST_StartPoint(geom)).
>
> That's basically visibility problem, been there somewhere around
> https://github.com/Komzpa/Mapnik-Sheets/blob/master/3d-buildings/3dbuil.xml#L95
>
> 2015-06-17 18:12 GMT+03:00 Paolo Crosato <paolo.crosato at targaubiest.com>:
>
>> Hi,
>>
>> I have a set of 2d polygons representing buildings. For each one, I have
>> to find the lenght of the edges that look towards north.
>>
>> Here http://imgur.com/HgpO2yH there is a small picture with a test case,
>> I have to compute the lenght of the red edges.
>>
>> Has anybody any suggestion on how to do this in postgis?
>>
>> Thanks for any input,
>>
>> Regards
>>
>> --
>> Paolo Crosato
>> Software engineer/Custom Solutions
>> e-mail: paolo.crosato at targaubiest.com
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>
>
>
>
> --
> Darafei "Komяpa" Praliaskouski
> OSM BY Team - http://openstreetmap.by/
> xmpp:me at komzpa.net mailto:me at komzpa.net
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150617/b9b63c89/attachment.html>


More information about the postgis-users mailing list