I would like to know the azimuth and tilt of a polygon / surface in a PostGIS database. The azimuth should be given e.g. from 0° to 360° degrees. The altitude should be between 0° to 90°. An example result table:

sid | azimuth | tilt | geom
 0  |     0   |   0  | ...
 1  |    90   |  45  | ...   

So sid 0 would represent a north facing wall and sid 1 a East facing roof with a 45° degree slope.

I guess the typical approach would look as follows:

  1. Find the surface's centroid
  2. Project a point North of it
  3. Measure the azimuth and angle between the centroid and the projected point

After giving it some more thought and taking into account that all of the involved functions (ST_Centroid, ST_Project, and ST_Azimuth) are not 3D capable, I feel like this may currently not be possible in PostGIS.

  • ST_Slope might help you too, though that works on a raster. Oct 15, 2015 at 7:03


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.