by
Janeth Kent
Date: 11-04-2013
This code will convert longitude and latitude in D'M'S format into a decimal format. It also contains the function to do the reverse. The example below does contain a couple of strange lines of code. You will notice that we seperate the integer and floating point values from the decimal format using a set of string functions, instead of using the math round or floor functions. This fixes a 'feature' in some versions of PHP that causes it to behave in an unpredictable manner when handling math with floating points. For example, if you include the code print(91.1 - 91); in PHP you may not get the result you expect. You will actually get 0.099999999999994, not 1 ! This tends to throw of the calculations in the example. |
|
by
Janeth Kent Date:
11-04-2013
hits :
7516
Janeth Kent
Licenciada en Bellas Artes y programadora por pasión. Cuando tengo un rato retoco fotos, edito vídeos y diseño cosas. El resto del tiempo escribo en MA-NO WEB DESIGN AND DEVELOPMENT.