Computing the lenght of a building's edges looking on a direction

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Computing the lenght of a building's edges looking on a direction

Paolo Crosato-2
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: [hidden email]

_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Computing the lenght of a building's edges looking on a direction

Darafei "Komяpa" Praliaskouski
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 <[hidden email]>:
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: [hidden email]

_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



--
Darafei "Komяpa" Praliaskouski
OSM BY Team - http://openstreetmap.by/
[hidden email] mailto:[hidden email]

_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Computing the lenght of a building's edges looking on a direction

Rémi Cura
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 <[hidden email]>:
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 <[hidden email]>:
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: [hidden email]

_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



--
Darafei "Komяpa" Praliaskouski
OSM BY Team - http://openstreetmap.by/
[hidden email] mailto:[hidden email]

_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Computing the lenght of a building's edges looking on a direction

Paolo Crosato-2
Thank you very much! I'll try with this approach.

Regards,

Paolo

Il 17/06/2015 18:24, Rémi Cura ha scritto:
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 <[hidden email]>:
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 <[hidden email]>:
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: [hidden email]

_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



--
Darafei "Komяpa" Praliaskouski
OSM BY Team - http://openstreetmap.by/
[hidden email] mailto:[hidden email]

_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


-- 
Paolo Crosato
Software engineer/Custom Solutions


_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users