10 Replies Latest reply on Mar 25, 2017 1:57 PM by codifi

    UTM Coordinates

    rmark

      Has anyone deleloped software to convert geographic coordinates (latitude & longitude) to UTM coordinates in Filemaker Pro or Filemaker Go?

        • 1. Re: UTM Coordinates
          Stephen Huston

          There is some Javacode in a converter available at:

          http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html

           

          You would need to reverse-engineer it into a custom function to work with the new FM12 Get-Location functions.

          1 of 1 people found this helpful
          • 2. Re: UTM Coordinates
            rmark

            Thank you. But is there any way to implement this in Filemaker when we don't have internet access?

            • 3. Re: UTM Coordinates
              Stephen Huston

              FM Go should be able to read the Location functions with even 3G access, but, if you have no network access at all, I don't know how you would collect the location data to use.

              • 4. Re: UTM Coordinates
                rmark

                The iPad GPS gets the location without any network access, but in geographic coordinates. The app "Coordinates" will get the location in UTM coordinates and copy them to the iOS clipboard. I now paste this string into FM Go and parse the UTM coordinates. It would be nice to find a solution that works entirely in FM without network access. I guess the code used in the web converter could be coded into FM.

                • 5. Re: UTM Coordinates
                  jml

                  Wikipedia lists the formulae for converting latitude and longitude to UTM but they are not trivial.  They appear feasible in FMPA at first glance:

                  http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system

                   

                  (The formula for artanh referenced in the aforementioned is also on wikipedia: http://en.wikipedia.org/wiki/Inverse_hyperbolic_function )

                  1 of 1 people found this helpful
                  • 6. Re: UTM Coordinates
                    rmark

                    Petrhaps some day I'll have the time to try to code this for FMP. Thanks to all.

                    • 7. Re: UTM Coordinates
                      taylorsharpe

                      Here is the let Statement that you can get UTM's Northing, Easting and Long Zone from.... just uncomment the field you want at the end (right now it is set for Northing):

                       

                      Let ( [

                      // Datum Constants
                        a = 6378137 ;              // equatorial radius
                        b = 6356752.314 ;      // polar radius
                        f = .003352811 ;      // flattening
                        invF = 298.2572236 ; // "1/f" or inverse flattening
                        rm = 6367435.68 ;     // Mean Radius

                      k0 = .9996 ;                     // scale factor
                        e = Sqrt(1-(b/a)^2) ;      // eccentricity
                        e2 = e*e/(1-e*e) ;          // e'2
                        n = (a-b)/(a+b) ;

                      // Meridional Arc Constants
                        A0 = a * ( 1 - n + ( 5 * n * n / 4 ) * ( 1 - n ) + ( 81 * n^4 / 64 ) * ( 1 - n ) ) ;
                        B0 = ( 3 * a * n / 2 ) * ( 1 - n - ( 7 * n * n / 8 ) * ( 1 - n ) + 55 * n^4 / 64 ) ;
                        C0 = ( 15 * a * n * n / 16 ) * ( 1 - n + ( 3 * n * n / 4 ) * ( 1 - n ) ) ;
                        D0 = ( 35 * a * n^3 / 48 ) * ( 1 - n + 11 * n * n / 16 ) ;
                        E0 = ( 315 * a * n^4 / 51 ) * ( 1 - n ) ;

                      // Calculation Constants
                        Sin1 = Pi / ( 180 * 3600 ) ;

                      Long Zone = 31 + Int ( Longitude / 6 ) ;
                        Long Zone CM = 6 * Long Zone - 183 ;
                        Delta Long Rad = ( Longitude - Long Zone CM ) * Pi / 180 ;
                        Lat Rad = Latitude * Pi / 180 ;
                        Long Rad = Longitude * Pi / 180 ;
                        r curv 1 ~ rho = a * ( 1 - e * e ) / ( ( 1 - ( e * Sin ( Lat Rad ) )^2 )^( 3 / 2 ) ) ;      //   r curv 1 = rho
                        r curv 2 ~ nu = a / ( ( 1 - ( e * Sin ( Lat Rad ) )^2 )^( 1 / 2 ) ) ;                             // r curv 2 = nu

                      Meridional Arc S = A0 * Lat Rad - B0 * Sin ( 2 * Lat Rad ) + C0 * Sin ( 4 * Lat Rad ) - D0 * Sin ( 6 * Lat Rad ) + E0 * Sin ( 8 * Lat Rad ) ;   // Calculate Meridional Arc Length

                      // Coefficients for UTM Coordinates
                        Ki = Meridional Arc S * k0 ;
                        Kii = r curv 2 ~ nu * Sin ( Lat Rad ) * Cos ( Lat Rad ) / 2 ;
                        Kiii = ( ( r curv 2 ~ nu * Sin ( Lat Rad ) * Cos ( Lat Rad )^3 ) / 24 ) * ( 5 - Tan ( Lat Rad )^2 + 9 * e2 * Cos ( Lat Rad )^2 + 4 * e2^2 * Cos ( Lat Rad )^4 ) * k0 ;
                        Kiv = r curv 2 ~ nu * Cos ( Lat Rad ) * k0 ;
                        Kv = ( Cos ( Lat Rad ) )^3 * ( r curv 2 ~ nu / 6 ) * ( 1 - Tan ( Lat Rad )^2 + e2 * Cos ( Lat Rad )^2 ) * k0 ;
                        A6 = ( ( Delta Long Rad )^6 * r curv 2 ~ nu * Sin ( Lat Rad ) * Cos ( Lat Rad )^5 / 720 ) * ( 61 - 58 * Tan ( Lat Rad )^2 + Tan ( Lat Rad )^4 + 270 * e2 * Cos ( Lat Rad )^2- 330 * e2 * Sin ( Lat Rad )^2 ) * k0 ;
                        Raw Northing = ( Ki + Kii * Delta Long Rad * Delta Long Rad + Kiii * Delta Long Rad^4 ) ;

                      Northing = If ( Raw Northing <0 ; 10000000 + Raw Northing ; Raw Northing )
                      Easting = 500000 + ( Kiv * Delta Long Rad + Kv * Delta Long Rad^3 )

                      ] ;

                       

                      Northing

                      //Easting

                      //Long Zone

                       

                      )

                      • 8. Re: UTM Coordinates
                        rmark

                        Thank you!

                         

                        --Bob Mark

                        • 9. Re: UTM Coordinates
                          rmark

                          I hads to make 2 changes to handle West (negative) longitude:

                           

                          Let ( [

                           

                           

                          longitude = Mod(longitude + 360; 360) ;

                          // Datum Constants

                            a = 6378137 ;              // equatorial radius

                            b = 6356752.314 ;      // polar radius

                            f = .003352811 ;      // flattening

                            invF = 298.2572236 ; // "1/f" or inverse flattening

                            rm = 6367435.68 ;     // Mean Radius

                           

                           

                          k0 = .9996 ;                     // scale factor

                            e = Sqrt(1-(b/a)^2) ;      // eccentricity

                            e2 = e*e/(1-e*e) ;          // e'2

                            n = (a-b)/(a+b) ;

                           

                           

                          // Meridional Arc Constants

                            A0 = a * ( 1 - n + ( 5 * n * n / 4 ) * ( 1 - n ) + ( 81 * n^4 / 64 ) * ( 1 - n ) ) ;

                            B0 = ( 3 * a * n / 2 ) * ( 1 - n - ( 7 * n * n / 8 ) * ( 1 - n ) + 55 * n^4 / 64 ) ;

                            C0 = ( 15 * a * n * n / 16 ) * ( 1 - n + ( 3 * n * n / 4 ) * ( 1 - n ) ) ;

                            D0 = ( 35 * a * n^3 / 48 ) * ( 1 - n + 11 * n * n / 16 ) ;

                            E0 = ( 315 * a * n^4 / 51 ) * ( 1 - n ) ;

                           

                           

                          // Calculation Constants

                            Sin1 = Pi / ( 180 * 3600 ) ;

                          Long Zone = 31 + Int ( Longitude / 6 ) ;

                            Long Zone CM = 6 * Long Zone - 183 ;

                          Long Zone = Mod(Long Zone; 60);

                           

                           

                            Delta Long Rad = ( Longitude - Long Zone CM ) * Pi / 180 ;

                            Lat Rad = Latitude * Pi / 180 ;

                            Long Rad = Longitude * Pi / 180 ;

                            r curv 1 ~ rho = a * ( 1 - e * e ) / ( ( 1 - ( e * Sin ( Lat Rad ) )^2 )^( 3 / 2 ) ) ;      //   r curv 1 = rho

                            r curv 2 ~ nu = a / ( ( 1 - ( e * Sin ( Lat Rad ) )^2 )^( 1 / 2 ) ) ;                             // r curv 2 = nu

                           

                           

                          Meridional Arc S = A0 * Lat Rad - B0 * Sin ( 2 * Lat Rad ) + C0 * Sin ( 4 * Lat Rad ) - D0 * Sin ( 6 * Lat Rad ) + E0 * Sin ( 8 * Lat Rad ) ;   // Calculate Meridional Arc Length

                           

                           

                          // Coefficients for UTM Coordinates

                            Ki = Meridional Arc S * k0 ;

                            Kii = r curv 2 ~ nu * Sin ( Lat Rad ) * Cos ( Lat Rad ) / 2 ;

                            Kiii = ( ( r curv 2 ~ nu * Sin ( Lat Rad ) * Cos ( Lat Rad )^3 ) / 24 ) * ( 5 - Tan ( Lat Rad )^2 + 9 * e2 * Cos ( Lat Rad )^2 + 4 * e2^2 * Cos ( Lat Rad )^4 ) * k0 ;

                            Kiv = r curv 2 ~ nu * Cos ( Lat Rad ) * k0 ;

                            Kv = ( Cos ( Lat Rad ) )^3 * ( r curv 2 ~ nu / 6 ) * ( 1 - Tan ( Lat Rad )^2 + e2 * Cos ( Lat Rad )^2 ) * k0 ;

                            A6 = ( ( Delta Long Rad )^6 * r curv 2 ~ nu * Sin ( Lat Rad ) * Cos ( Lat Rad )^5 / 720 ) * ( 61 - 58 * Tan ( Lat Rad )^2 + Tan ( Lat Rad )^4 + 270 * e2 * Cos ( Lat Rad )^2- 330 * e2 * Sin ( Lat Rad )^2 ) * k0 ;

                            Raw Northing = ( Ki + Kii * Delta Long Rad * Delta Long Rad + Kiii * Delta Long Rad^4 ) ;

                           

                           

                          Northing = If ( Raw Northing <0 ; 10000000 + Raw Northing ; Raw Northing )

                          //Easting = 500000 + ( Kiv * Delta Long Rad + Kv * Delta Long Rad^3 )

                           

                           

                          ] ;

                           

                           

                           

                           

                           

                          Northing

                           

                           

                          //Easting

                           

                           

                          //Long Zone

                           

                           

                           

                           

                           

                          )

                          • 10. Re: UTM Coordinates
                            codifi

                            Hey Robert - Michael Ashley here.

                             

                            This is one of the things I wanted to talk to you about! Do you know what datum this uses? Most always we need NAD83, not WGS84. Thoughts?