# Tag Info

3

You're correct that this UoM is called decimal degrees, and partially correct that the value varies depending where you are on earth. One degree of latitude is always about the same width. One degree of longitude varies depending on what latitude you're at. The accepted answer to this question explains it well: Calculating longitude length in miles? The ...

2

Obligatory XKCD reference: More detailed answer

2

When converting from DD⁰ MM' SS", you must remember that S latitudes will become negative and that W longitudes will become negative. Simply multiply the converted lat and/or lon by -1.

2

Writing functions that are supposed to return a certain thing (or things) and can actually return something else is bad practice and can cause unexpected errors to creep in. The standard way of doing this is to raise an exception with an informative message. # Handle Python 2.x. try:input = raw_input except NameError:pass def dms2dd(degrees, minutes, ...

2

I have a layer in OSGB coordinates (EPSG code 27700) and I can use to_dms(x(transform(\$geometry,'EPSG:4326','epsg:4326')), 'x', 3) to get a DMS representation of the point coordinates. For example, I can use this expression in the labelling engine: and my points get labelled with the DMS longitude, even though their coordinate system is still OSGB metres: ...

1

You should use the to_dms expression. to_dms(\$x, 'x', 3) If your geometry is not in EPSG:4326, reproject it on the fly, like this: to_dms(x(transform(\$geometry,'EPSG:2154','EPSG:4326')), 'x', 3) Source : http://changelog.qgis.org/en/qgis/version/3.4-LTR/#map-expressions

Only top voted, non community-wiki answers of a minimum length are eligible