Share My Creation A library with a password

Hi everybody:
I am presenting the idea of protecting a developer library ( or any app) with a password.
I wrote a Latitude-Longitude library to find the distance, bearing, and midpoint, to a very high precision, between two geolocations in terms of their latitudes and longitudes.
Each function of the three is included in a sub as follows:
  • DisBetweenLatLong(Lat1 As Double,Long1 As Double,Lat2 As Double,Long2 As Double) As Double
  • BearingBetweenLatLon(Lat1 As Double,Long1 As Double,Lat2 As Double,Long2 As Double) As Double
  • MidPointBetweenLatLon(Lat1 As Double,Long1 As Double,Lat2 As Double,Long2 As Double) As Double()
Another function is taken from the forum (https://www.b4x.com/android/forum/threads/convert-latitude-longitude-strings-to-double.63413/):
  • Util_convert_lat_long(Lat_long_string As String) As Double
Which will convert any positive or negative Latitude and Longitude value from string to double.
The library can be updated with any function.
1617577571103.png

A function called password that takes a string as a parameter will check for functions whether to be implemented or not as follows:

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private ll As Latlong
End Sub
'
'
'
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    ll.password("xxxxxxxxxx")
    Log("Distance Between Cambridge and Bristol = " & ll.DisBetweenLatLong(52.2053,0.1218,51.4545,-2.5879))
    Log("Distance Between Bristol and Cambridge = " & ll.DisBetweenLatLong(51.4545,-2.5879,52.2053,0.1218))

    Log("Bearing Between Bristol and Cambridge = " & ll.BearingBetweenLatLon(52.2053,0.1218,51.4545,-2.5879))
    Log("Distance Between Cambridge and Bristol  = " &ll.BearingBetweenLatLon(51.4545,-2.5879,52.2053,0.1218))
  
    Dim coor(2) As Double
    coor= ll.MidPointBetweenLatLon(52.2053,0.1218,51.4545,-2.5879)
    Log("Lat of midpoint Between Cambridge and Bristol  = " & coor(0) )
    Log("Lon of midpoint Between Cambridge and Bristol  = " & coor(1) )
    coor=ll.MidpointBetweenLatLon(51.4545,-2.5879,52.2053,0.1218)
    Log("Lat of midpoint Between Bristol and Cambridge  = " & coor(0) )
    Log("Lon of midpoint Between Bristol and Cambridge   = " & coor(1) )

End Sub

So if the password "xxxxxxxxxxx" is the correct one, the user will be given access to the functions. The algorithm of password generator implies a string with a certain number and sequence of letters.
1617578969053.png


If the password is not correct, no function is carried out and a notice will appear in the log.
1617578676028.png

Anyone who puts a like and comments will be eligible to receive the library password by DM.
The source code can be purchased at $25 by PayPal
 

Attachments

  • LatlongLib.zip
    23.6 KB · Views: 252
Last edited:

TILogistic

Expert
Licensed User
Longtime User
I wrote a Latitude-Longitude library to find the distance, bearing, and midpoint, to a very high precision, between two geolocations in terms of their latitudes and longitudes.

How did you achieve this high precision?
 

TILogistic

Expert
Licensed User
Longtime User
I'm afraid that you can't easily protect jar files. It took me only a couple of minutes to open the code and find the password (it's a 6 letter word but only the first three are actually used).

you can only obfuscate your Jar, there are techniques on how to do that, to make it difficult to understand the code.

your code (JD-GUI Tools):

1617589421283.png


and its precision is not high.

sorry,
 

jkhazraji

Active Member
Licensed User
Longtime User
I'm afraid that you can't easily protect jar files. It took me only a couple of minutes to open the code and find the password (it's a 6 letter word but only the first three are actually used).
It is the idea that matters. This code is not intended to show how to encrypt the app but to associate it with a password. I know that it is very easy to reach the code from the .jar file. but since It is not a challenge, I was way generous to share the code. I would have used a very sophisticated algorithm to generate the password but as I mentioned it is the idea that matters.
 

jkhazraji

Active Member
Licensed User
Longtime User
you can only obfuscate your Jar, there are techniques on how to do that, to make it difficult to understand the code.

your code (JD-GUI Tools):

View attachment 111014

and its precision is not high.

sorry,
you can only obfuscate your Jar, there are techniques on how to do that, to make it difficult to understand the code.

your code (JD-GUI Tools):

View attachment 111014

and its precision is not high.

sorry,
How do you measure precision in such case? What is the criterion? It sure is not a persona l opinion. I checked my results against that given by specialized websites.
Check in the following site:

1617617131013.png

I know about abfuscation but it was a friendly gesture to share the compiled library. The original code is written in b4x not the code generated by cavaj.
 
Last edited:

Sandman

Expert
Licensed User
Longtime User
This code is not intended to show how to encrypt the app but to associate it with a password. I know that it is very easy to reach the code from the .jar file. but since It is not a challenge, I was way generous to share the code. I would have used a very sophisticated algorithm to generate the password but as I mentioned it is the idea that matters.
For you it might be the idea that matters. (And I'd say it's not a brand new idea to protect code with a password.) But it's the code you're selling for $25.

it was a friendly gesture to share the compiled library
In all fairness, you're not sharing the compiled library. You're selling it - which is fine, obviously, but you're not sharing it.

A friendly note: You will most likely make more sales if you listen to input instead of going defensive.
 

jkhazraji

Active Member
Licensed User
Longtime User
For you it might be the idea that matters. (And I'd say it's not a brand new idea to protect code with a password.) But it's the code you're selling for $25.


In all fairness, you're not sharing the compiled library. You're selling it - which is fine, obviously, but you're not sharing it.

A friendly note: You will most likely make more sales if you listen to input instead of going defensive.
It is brand new on this forum. I am selling the code not the compiled library and sharing the idea . The effort is worth more than this amount and this is the right place to share and sell as the heading tells.
 

jkhazraji

Active Member
Licensed User
Longtime User
Thankfully the world is bigger than this forum. :)


I wish you good luck, and with that I exit this thread.
Thanks. You have been of great help :) .
 

roumei

Active Member
Licensed User
How do you measure precision in such case? What is the criterion?

Measuring the distance between two points on earth by using a sphere is not accurate and certainly not 'high precision'. You have to at least use a spheroid. I would measure the distance with an appropriate map projection of your region of interest. In your case, the projection should be 'OSGB 1936 / British National Grid' (EPSG:27700) but you could also use UTM Zone 30 North. The difference between your simple spherical calculation and the more accurate approach is more than 500 meters.
B4X:
Simple: 204,047.79 m
Accurate: 204,550.62 m
Difference: 502.82 m
In case you're interested in improving the calculation, this is the code:
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    
    Type eLatLon(Latitude As Double, Longitude As Double)
    Type eProjCoordinate(Easting As Double, Northing As Double)
    
    Private const Deg2Rad As Double = 2*cPI/360
    Private const rad2deg As Double = 360 / (2 * cPI)
    Private const MathPIdiv180 As Double = cPI / 180
    Private Const Airy1830_A As Double = 6377563.396
    Private Const Airy1830_B As Double = 6356256.909
    Private Const WGS84_a As Double = 6378137
    Private Const WGS84_b As Double = 6356752.3142
    
End Sub

Public Sub Initialize
    
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    
    Dim SimpleDistance As Double = GetSimpleDistanceInMetersBetweenTwoLatLons(52.2053, 0.1218, 51.4545, -2.5879)
    
    Dim p0 As eProjCoordinate = GetEnglandCoordinateFromLatLon(52.2053, 0.1218)
    Dim p1 As eProjCoordinate = GetEnglandCoordinateFromLatLon(51.4545, -2.5879)
    Dim AccurateDistance As Double = GetDistance(p0.Easting, p0.Northing, p1.Easting, p1.Northing)

    Log("Simple: " & NumberFormat(SimpleDistance, 1,2) & " m")
    Log("Accurate: " & NumberFormat(AccurateDistance, 1,2) & " m")
    Log("Difference: " & NumberFormat(AccurateDistance - SimpleDistance, 1,2) & " m")
    
End Sub

Public Sub GetSimpleDistanceInMetersBetweenTwoLatLons(lat1 As Double, lon1 As Double, lat2 As Double, lon2 As Double) As Double
    Dim R As Double = 6371e3
    Dim phi1 As Double = lat1 * Deg2Rad
    Dim phi2 As Double = lat2 * Deg2Rad
    Dim deltaphi As Double = phi2-phi1
    Dim deltalambda As Double = (lon2-lon1) * Deg2Rad
    Dim sindeltaphihalf As Double = Sin(deltaphi/2)
    Dim sindeltalambdahalf As Double = Sin(deltalambda/2)
    Dim a As Double = sindeltaphihalf * sindeltaphihalf + Cos(phi1) * Cos(phi2) * sindeltalambdahalf * sindeltalambdahalf
    Dim c As Double = 2 * ATan2(Sqrt(a), Sqrt(1-a))
    Return R*c
End Sub


Private Sub GetDistance(Easting1 As Double, Northing1 As Double, Easting2 As Double, Northing2 As Double) As Double
    Dim dx As Double = Easting2 - Easting1
    Dim dy As Double = Northing2 - Northing1
    Return Sqrt(dx*dx + dy*dy)
End Sub

Private Sub GetEnglandCoordinateFromLatLon(Latitude As Double, Longitude As Double) As eProjCoordinate
    
    Dim eg As eLatLon = HelmertTransformation(Latitude, Longitude, Airy1830_A, Airy1830_B, WGS84_a, WGS84_b, _
                                                   446.448, -125.157, 542.06, _
                                                   0.1502 / 3600 * cPI / 180, 0.247 / 3600 * cPI / 180,  0.8421 / 3600 * cPI / 180, -20.4894 / 1000000 + 1, _
                                                   False)
    Dim e As eProjCoordinate = GetTransverseMercatorFromLatLon(eg.Latitude, eg.Longitude, 400000, -100000, -2, 0.9996012717, 49, Airy1830_A, Airy1830_B)
    Return e
    
End Sub

Private Sub HelmertTransformation(Latitude As Double, _
                                  Longitude As Double, _
                                  a_in As Double, b_in As Double, a_out As Double, b_out As Double, tx As Double, ty As Double, tz As Double, _
                                  rx As Double, ry As Double, rz As Double, s1 As Double, _
                                  bToWGS84 As Boolean) As eLatLon

    If bToWGS84 = False Then
        Dim temp_a_in As Double = a_in
        Dim temp_b_in As Double = b_in
        Dim temp_a_out As Double = a_out
        Dim temp_b_out As Double = b_out
        a_in = temp_a_out
        b_in = temp_b_out
        a_out = temp_a_in
        b_out = temp_b_in
        rx = (-1)*rx
        ry = (-1)*ry
        rz = (-1)*rz
        tx = (-1)*tx
        ty = (-1)*ty
        tz = (-1)*tz
        s1 = (-(s1 - 1) * 1000000) / 1000000 + 1
    End If

    Dim lat As Double = Latitude * Deg2Rad
    Dim lon As Double = Longitude * Deg2Rad

    Dim a As Double = a_in
    Dim b As Double = b_in
    Dim sinPHI As Double = Sin(lat)
    Dim cosPHI As Double = Cos(lat)
    Dim sinLambda As Double = Sin(lon)
    Dim cosLambda As Double = Cos(lon)
    Dim H As Double = 0
    Dim eSq As Double = (a * a - b * b) / (a * a)
    Dim nu As Double = a / Sqrt(1 - eSq * sinPHI * sinPHI)
    Dim x1 As Double = (nu + H) * cosPHI * cosLambda
    Dim y1 As Double = (nu + H) * cosPHI * sinLambda
    Dim z1 As Double = ((1 - eSq) * nu + H) * sinPHI

    Dim x2 As Double = tx + x1 * s1 - y1 * rz + z1 * ry
    Dim y2 As Double = ty + x1 * rz + y1 * s1 - z1 * rx
    Dim z2 As Double = tz - x1 * ry + y1 * rx + z1 * s1

    a = a_out
    b = b_out
    Dim precision As Double = 2 / a
    eSq = (a * a - b * b) / (a * a)
    Dim p As Double = Sqrt(x2 * x2 + y2 * y2)
    Dim phi As Double = ATan2(z2, p * (1 - eSq))
    Dim phiP As Double = 2 * cPI
    
    Do While (Abs(phi - phiP) > precision)
        nu = a / Sqrt(1 - eSq * Sin(phi) * Sin(phi))
        phiP = phi
        phi = ATan2(z2 + eSq * nu * Sin(phi), p)
    Loop

    Dim lambda As Double = ATan2(y2, x2)
    H = p / Cos(phi) - nu

    Dim egps As eLatLon
    egps.Latitude = phi * rad2deg
    egps.Longitude = lambda * rad2deg
    
    Return egps
    
End Sub

Private Sub GetTransverseMercatorFromLatLon(Latitude As Double, _
                                            Longitude As Double, _
                                            FalseEasting As Double, _
                                            FalseNorthing As Double, _
                                            CentralMeridian As Double, _
                                            CentralMeridianScaleFactor As Double, _
                                            LatitudeOfOrigin As Double, _
                                            Ellipsoid_A As Double, _
                                            Ellipsoid_B As Double) As eProjCoordinate

    Dim Northing, Easting, eccPrimeSquared, nu, T, C, A, M, M0 As Double
    Dim eccSquared As Double = Ellipsoid_B / Ellipsoid_A
    eccSquared = 1 - eccSquared * eccSquared

    If Longitude < -180 Then Longitude = Longitude + 360
    If Longitude > 180 Then Longitude = Longitude - 360
    Dim LatRad As Double = Latitude * MathPIdiv180
    Dim LongRad As Double = Longitude * MathPIdiv180
    Dim LongOriginRad As Double = CentralMeridian * MathPIdiv180
    Dim LatOriginRad As Double = LatitudeOfOrigin * MathPIdiv180
    eccPrimeSquared = eccSquared / (1 - eccSquared)
    nu = Ellipsoid_A / Sqrt(1 - eccSquared * Sin(LatRad) * Sin(LatRad))
    T = Tan(LatRad) * Tan(LatRad)
    C = eccPrimeSquared * Cos(LatRad) * Cos(LatRad)
    A = Cos(LatRad) * (LongRad - LongOriginRad)
    M = Ellipsoid_A * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Sin(6 * LatRad))
    M0 = Ellipsoid_A * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatOriginRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Sin(2 * LatOriginRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Sin(4 * LatOriginRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Sin(6 * LatOriginRad))
    Easting = (CentralMeridianScaleFactor * nu * (A + (1 - T + C) * A * A * A / 6 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120))
    Northing = (CentralMeridianScaleFactor * (M - M0 + nu * Tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720)))

    Dim Coord As eProjCoordinate
    Coord.Easting = Easting + FalseEasting
    Coord.Northing = Northing + FalseNorthing
    Return Coord

End Sub
 

jkhazraji

Active Member
Licensed User
Longtime User
Measuring the distance between two points on earth by using a sphere is not accurate and certainly not 'high precision'. You have to at least use a spheroid. I would measure the distance with an appropriate map projection of your region of interest. In your case, the projection should be 'OSGB 1936 / British National Grid' (EPSG:27700) but you could also use UTM Zone 30 North. The difference between your simple spherical calculation and the more accurate approach is more than 500 meters.
B4X:
Simple: 204,047.79 m
Accurate: 204,550.62 m
Difference: 502.82 m
In case you're interested in improving the calculation, this is the code:
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
   
    Type eLatLon(Latitude As Double, Longitude As Double)
    Type eProjCoordinate(Easting As Double, Northing As Double)
   
    Private const Deg2Rad As Double = 2*cPI/360
    Private const rad2deg As Double = 360 / (2 * cPI)
    Private const MathPIdiv180 As Double = cPI / 180
    Private Const Airy1830_A As Double = 6377563.396
    Private Const Airy1830_B As Double = 6356256.909
    Private Const WGS84_a As Double = 6378137
    Private Const WGS84_b As Double = 6356752.3142
   
End Sub

Public Sub Initialize
   
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
   
    Dim SimpleDistance As Double = GetSimpleDistanceInMetersBetweenTwoLatLons(52.2053, 0.1218, 51.4545, -2.5879)
   
    Dim p0 As eProjCoordinate = GetEnglandCoordinateFromLatLon(52.2053, 0.1218)
    Dim p1 As eProjCoordinate = GetEnglandCoordinateFromLatLon(51.4545, -2.5879)
    Dim AccurateDistance As Double = GetDistance(p0.Easting, p0.Northing, p1.Easting, p1.Northing)

    Log("Simple: " & NumberFormat(SimpleDistance, 1,2) & " m")
    Log("Accurate: " & NumberFormat(AccurateDistance, 1,2) & " m")
    Log("Difference: " & NumberFormat(AccurateDistance - SimpleDistance, 1,2) & " m")
   
End Sub

Public Sub GetSimpleDistanceInMetersBetweenTwoLatLons(lat1 As Double, lon1 As Double, lat2 As Double, lon2 As Double) As Double
    Dim R As Double = 6371e3
    Dim phi1 As Double = lat1 * Deg2Rad
    Dim phi2 As Double = lat2 * Deg2Rad
    Dim deltaphi As Double = phi2-phi1
    Dim deltalambda As Double = (lon2-lon1) * Deg2Rad
    Dim sindeltaphihalf As Double = Sin(deltaphi/2)
    Dim sindeltalambdahalf As Double = Sin(deltalambda/2)
    Dim a As Double = sindeltaphihalf * sindeltaphihalf + Cos(phi1) * Cos(phi2) * sindeltalambdahalf * sindeltalambdahalf
    Dim c As Double = 2 * ATan2(Sqrt(a), Sqrt(1-a))
    Return R*c
End Sub


Private Sub GetDistance(Easting1 As Double, Northing1 As Double, Easting2 As Double, Northing2 As Double) As Double
    Dim dx As Double = Easting2 - Easting1
    Dim dy As Double = Northing2 - Northing1
    Return Sqrt(dx*dx + dy*dy)
End Sub

Private Sub GetEnglandCoordinateFromLatLon(Latitude As Double, Longitude As Double) As eProjCoordinate
   
    Dim eg As eLatLon = HelmertTransformation(Latitude, Longitude, Airy1830_A, Airy1830_B, WGS84_a, WGS84_b, _
                                                   446.448, -125.157, 542.06, _
                                                   0.1502 / 3600 * cPI / 180, 0.247 / 3600 * cPI / 180,  0.8421 / 3600 * cPI / 180, -20.4894 / 1000000 + 1, _
                                                   False)
    Dim e As eProjCoordinate = GetTransverseMercatorFromLatLon(eg.Latitude, eg.Longitude, 400000, -100000, -2, 0.9996012717, 49, Airy1830_A, Airy1830_B)
    Return e
   
End Sub

Private Sub HelmertTransformation(Latitude As Double, _
                                  Longitude As Double, _
                                  a_in As Double, b_in As Double, a_out As Double, b_out As Double, tx As Double, ty As Double, tz As Double, _
                                  rx As Double, ry As Double, rz As Double, s1 As Double, _
                                  bToWGS84 As Boolean) As eLatLon

    If bToWGS84 = False Then
        Dim temp_a_in As Double = a_in
        Dim temp_b_in As Double = b_in
        Dim temp_a_out As Double = a_out
        Dim temp_b_out As Double = b_out
        a_in = temp_a_out
        b_in = temp_b_out
        a_out = temp_a_in
        b_out = temp_b_in
        rx = (-1)*rx
        ry = (-1)*ry
        rz = (-1)*rz
        tx = (-1)*tx
        ty = (-1)*ty
        tz = (-1)*tz
        s1 = (-(s1 - 1) * 1000000) / 1000000 + 1
    End If

    Dim lat As Double = Latitude * Deg2Rad
    Dim lon As Double = Longitude * Deg2Rad

    Dim a As Double = a_in
    Dim b As Double = b_in
    Dim sinPHI As Double = Sin(lat)
    Dim cosPHI As Double = Cos(lat)
    Dim sinLambda As Double = Sin(lon)
    Dim cosLambda As Double = Cos(lon)
    Dim H As Double = 0
    Dim eSq As Double = (a * a - b * b) / (a * a)
    Dim nu As Double = a / Sqrt(1 - eSq * sinPHI * sinPHI)
    Dim x1 As Double = (nu + H) * cosPHI * cosLambda
    Dim y1 As Double = (nu + H) * cosPHI * sinLambda
    Dim z1 As Double = ((1 - eSq) * nu + H) * sinPHI

    Dim x2 As Double = tx + x1 * s1 - y1 * rz + z1 * ry
    Dim y2 As Double = ty + x1 * rz + y1 * s1 - z1 * rx
    Dim z2 As Double = tz - x1 * ry + y1 * rx + z1 * s1

    a = a_out
    b = b_out
    Dim precision As Double = 2 / a
    eSq = (a * a - b * b) / (a * a)
    Dim p As Double = Sqrt(x2 * x2 + y2 * y2)
    Dim phi As Double = ATan2(z2, p * (1 - eSq))
    Dim phiP As Double = 2 * cPI
   
    Do While (Abs(phi - phiP) > precision)
        nu = a / Sqrt(1 - eSq * Sin(phi) * Sin(phi))
        phiP = phi
        phi = ATan2(z2 + eSq * nu * Sin(phi), p)
    Loop

    Dim lambda As Double = ATan2(y2, x2)
    H = p / Cos(phi) - nu

    Dim egps As eLatLon
    egps.Latitude = phi * rad2deg
    egps.Longitude = lambda * rad2deg
   
    Return egps
   
End Sub

Private Sub GetTransverseMercatorFromLatLon(Latitude As Double, _
                                            Longitude As Double, _
                                            FalseEasting As Double, _
                                            FalseNorthing As Double, _
                                            CentralMeridian As Double, _
                                            CentralMeridianScaleFactor As Double, _
                                            LatitudeOfOrigin As Double, _
                                            Ellipsoid_A As Double, _
                                            Ellipsoid_B As Double) As eProjCoordinate

    Dim Northing, Easting, eccPrimeSquared, nu, T, C, A, M, M0 As Double
    Dim eccSquared As Double = Ellipsoid_B / Ellipsoid_A
    eccSquared = 1 - eccSquared * eccSquared

    If Longitude < -180 Then Longitude = Longitude + 360
    If Longitude > 180 Then Longitude = Longitude - 360
    Dim LatRad As Double = Latitude * MathPIdiv180
    Dim LongRad As Double = Longitude * MathPIdiv180
    Dim LongOriginRad As Double = CentralMeridian * MathPIdiv180
    Dim LatOriginRad As Double = LatitudeOfOrigin * MathPIdiv180
    eccPrimeSquared = eccSquared / (1 - eccSquared)
    nu = Ellipsoid_A / Sqrt(1 - eccSquared * Sin(LatRad) * Sin(LatRad))
    T = Tan(LatRad) * Tan(LatRad)
    C = eccPrimeSquared * Cos(LatRad) * Cos(LatRad)
    A = Cos(LatRad) * (LongRad - LongOriginRad)
    M = Ellipsoid_A * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Sin(6 * LatRad))
    M0 = Ellipsoid_A * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatOriginRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Sin(2 * LatOriginRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Sin(4 * LatOriginRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Sin(6 * LatOriginRad))
    Easting = (CentralMeridianScaleFactor * nu * (A + (1 - T + C) * A * A * A / 6 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120))
    Northing = (CentralMeridianScaleFactor * (M - M0 + nu * Tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720)))

    Dim Coord As eProjCoordinate
    Coord.Easting = Easting + FalseEasting
    Coord.Northing = Northing + FalseNorthing
    Return Coord

End Sub
Well, I am very much interested in that and grateful for your generous reply. Thanks. šŸŒ¹
 

jkhazraji

Active Member
Licensed User
Longtime User
It took me only a couple of minutes to open the code and find the password (it's a 6 letter word but only the first three are actually used).
Well done, cavaj, but it is not the first three letters really.
 
Top