We will shortly be collecting data from our remote systems that track ADS-B signals from Aircraft. This data will provide the lat/lon in epsg:4326 (wgs84) and a height in meters. The station location is known in EPSG:4326 as a lat/lon.

We want to be able to visualize the effective range of the signals for planning additional stations. The 3D is required to visualize LOS (line of Sight) shadows due to mountains, man made obstacles, etc.

How do we do the following using PostGis:

  • Calculate the bearing from True North from the station to the aircraft position
  • Calculate the distance over the ground between the two points
  • Calculate the distance to the point factoring in the height as well.

Assuming that we then store in a PostGis Database the furthermost distance for each radial, how do we do the following using PostGis:

  • Create a cool looking polygon that connects the points with curves in 2D for use in OpenLayers
  • Create a cool looking polygon that connects the points with curves taking in the height (z) for output to a kml file for use in Google Earth to visualize the range three dimensionally
  • If you want a viewshed analysis you might consider using GRASS. Aug 25, 2013 at 20:35
  • 1
    Take a look at this Online Google Earth Airspace Awareness Tool kdotapp2.ksdot.org/KDOT_AirSpace/Default.aspx
    – Mapperz
    Aug 25, 2013 at 21:44
  • @Mapperz What a NICE Tool. This is what I had in mind for visualizing our data. The idea is to see where the radio reception is good and poor and understand why. often terrain plays a big part in he LOS reception. Then we can site additional receivers to compensate. Aug 26, 2013 at 1:23

1 Answer 1


For your first two questions, ST_Azimuth and ST_Distance would seem to do the trick. To get the three-space distance you might just have to manually convert the coordinates to geocentric and then just calculate the distance using pythagoras.

  • I'd be wary of using Pythagoras for calulating spheroid distances. First go with the built in PostGIS functions, like this: ST_distance(geometry, geometry) or this: postgis.refractions.net/documentation/manual-1.3/…
    – Alex Leith
    Aug 26, 2013 at 5:20
  • You misunderstand. Once the coordinates are converted to geocentric, a pythagorean distance is the distance between the points. Aug 27, 2013 at 17:30
  • If you mean geocentric like this: kartoweb.itc.nl/geometrics/Bitmaps/… then you are calculating a straight line distance through the Earth. You want a distance across the surface of the Earth, with curvature? This article says that you should use the Haversine formula for distances greater than 20 km: movable-type.co.uk/scripts/gis-faq-5.1.html. My point is that if you start goign down to first principles, it gets hard, so use some code someone has already written.
    – Alex Leith
    Aug 27, 2013 at 22:33

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.