I have vector data of 3D City Model in PostgreSQL database. So from my data geometry column, which is a surface geometry. (These are geometries of all the surfaces of buildings). I had extracted the points through
ST_DumpPoints query as follows:
SELECT (ST_x(geom)) AS X, ST_y(geom) AS Y FROM ( SELECT (St_DumpPoints(geometry)).geom from surface_geometry WHERE cityobject_id=95 ) AS foo
Now I would like to calculate the azimuth from the origin (the below-created point) to all the points extracted with the above query from all the surface polygons. Considering this point created below as position, viewpoint or GPS position of an observer, I am building it with MakePoint as below. (So as observer position, I would be changing this point everytime or is there any way to automatise this?)
SELECT (ST_x(StandPoint)) AS X, ST_y(StandPoint) AS Y FROM ( SELECT ST_SetSRID(ST_MakePoint(391139.27, 5821816.69), 25833) AS StandPoint) AS foo
I have seen in PostGIS that there is a way to calculate azimuth between two points. The function ST_Azimuth calculate between two points as in PostGIS manual. But how to calculate azimuth from one to many? Any tips on how to proceed?
Later I want to store that calculate the azimuth in a variable in python using PsyCopg 2 (This part is not difficult) for my further calculations.