Tuesday 24 October 2017

qgis - Using postgis to generate building shades



I am currently working on a solar potential estimation tool for existing buildings. The idea is to use buildings (=Polygon) shape, their height, and create the resulting shade at a given hour. I am only going to do the test for a few position of the sun. I know about the grass function r.sun.mask but it is overpowered for what I am trying to do.


For now I only want to get the shade when the sun is south, at 18° in the sky. The building should therefore cast a shadow about three times its height.


What I am trying to get:


What I am trying to get


I have been looking for a while but I did not find any tool in postgis to do this. I was thinking about buffering and then cutting the polygon but could not make it work. Do you know any tool or have any idea how to do it?



Answer



Simplest way to do this is with an



ST_Extrude(geom,x-direction,y-direction,0)




You will have to calculate the extrude factor yourself of course and it assumes your whole polygon is the same height.(in your example, extrude would be like: ST_Extrude(geom, 0, 3.0*height, 0) )


Here is the manual on ST_Extrude. Keep in mind that you need postgis with SFCGAL for this, check the installation docs on how to get this if you don't already have it.


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