I often need to provide coordinates to light aircraft pilots – and most of them still use degree-minute-second notation (DMS) for charts and GPS. If we can’t upload flight plans and waypoints directly to the GPS I need to provide tables of DMS points – while QGIS can display in DMS in the canvas, it doesn’t have built-in functions for calculating and filling attribute fields.
A GIS.Stackexchange.com user shared part of the code for this last year, and with QGIS 1.9 the floor() function in the field calculator lets it work properly.
- Add your latlong point file to QGIS (or save-as in latlong then open it);
- Open the attribute table and start editing, then open the field calculator;
- Create a new text field of length 16, named ‘lon_dms’, and enter the code below in the ‘Expression’ box;
- Calculate, then repeat for ‘lat_dms’ but change each $x to $y.
Edit 2017-01-16 – thanks to Skippy for pointing out the southern hemisphere error in the DMS coordinates. Here’s a better version for more general usage, giving N and S labels for latitude: