DMStoDDM ( )

Function stats

Average user rating
96
393
9999
Support
FileMaker 7.0 +
Date posted
08 July 2016
Version
1
Recursive function
No

Author Info
 sijmons

1 functions

Average Rating None

author_avatar



 

Function overview

Prototype

DMStoDDM  ( LATorLNG )


Parameters

LATorLNG  Latitude or Longitude in DMS format


Description

Geocodes in Degree Minutes Seconds (DMS) need to be converted to Degree Decimal Minutes (DDM) before they can be used in GoogleMaps webviewers.

The final decimal conversion is used when on systems that have a decimal comma. DDM needs a decimal point before converting to HTML

Examples

Sample input

N 24° 31' 37.6854"
S 24° 12' 24.8026"
24° 12' 24.8026" S


Sample output

24.5271334833333
-24.206889611111
-24.206889611111

 

Function code

Let ( [

Geo = Substitute ( LATorLNG ; "\"" ; "" ) ;

Lettr =
Case (
PatternCount ( Geo ; "S" ) ; "-" ;
PatternCount ( Geo; "W" ) ; "-" ;
"" ) ;

Stripped = Substitute ( Geo ; ["N" ; ""] ; ["S" ; ""] ; ["E" ; ""] ; ["W" ; ""] ) ;
Degr = LeftWords ( Stripped ; 1 ) ;
Mn = MiddleWords ( Stripped ; 2; 1 ) ;
Sec = MiddleWords ( Stripped ; 3; 1 ) ;

Mnn = Mn + ( Sec / 60 ) ;
DecDegr = ( Mnn / 60 )

] ;

Substitute ( Lettr & Degr & DecDegr ; "," ; "." )
)


//20160708 Sijmons, Szienz geocode conversion from DMS to DDM which is used in GoogleMaps Webviewers. Systems with decimal code as commas are converted to required decimal point.

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/393

    Prototype: DMStoDDM( LATorLNG )
    Function Author: sijmons (http://www.fmfunctions.com/mid/96)
    Last updated: 08 July 2016
    Version: 1

*/
// ===================================

 

 

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (32)
Date  (28)
XML  (27)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Layout  (15)
Interface  (15)
Text  (14)
Variables  (13)
Filter  (12)
Layout Objects  (11)
Design  (10)
Array  (8)