Thanks Lew. I have figured it out (after reading the API docs ++.) So here is the code I use to transform the Lat long to UTM ( in case anyone else wouders..)
[code] public void convert (){ double a = 6378137; double b = 6356752.3142; e = Math.sqrt(1-Math.pow(b,2)/Math.pow(a, 2)); // a and b are constants. e2 = e*e/(1-(e*e)); n =(a-b)/(a+b); A0 = a*(1 - n + (5/4)*(Math.pow(n,2) - Math.pow(n,3)) + (81/64)*(Math.pow(n,4) - Math.pow(n,5))); B0 =(3*a*n/2)*(1 - n - (7*n*n/8)*(1-n) + (55/64)*(Math.pow(n, 4)-Math.pow(n, 5))); C0 =(15*a*n*n/16)*(1 - n +(3*n*n/4)*(1-n)); D0 =(35*a*Math.pow(n, 3)/48)*(1 - n + 11*n*n/16); E0 =(315*a*Math.pow(n,4)/51)*(1-n); zone = (int) (31 + (lngdeg/6)); double pi = 6* zone -183; double pii = (lngdeg-pi)*Math.PI/180; double rho1 = (1-(e*e) * (Math.sin(lat)*( Math.sin(lat)))); rho = a * (1-e*e)/ Math.pow(rho1, (3/2)); nu = a/(Math.pow((1-(e*e *(Math.sin(lat))*(Math.sin(lat)))), (1/2))); S = A0* lat - B0 * Math.sin(2*lat) + C0 * Math.sin(4*lat) - D0 * Math.sin(6*lat) + E0 * Math.sin(8*lat); double Ki = S * knu; double Kii = knu * nu *Math.sin(lat)*Math.cos(lat)/2; double Kiii = (knu * nu *Math.sin(lat)*Math.pow(Math.cos(lat),3)/24)*(5-Math.pow(Math.tan(lat),2)+9*Math.pow(e2,2)*Math.pow(Math.cos(lat),2)+4*Math.pow(e2 ,2)*Math.pow(Math.cos(lat),4)); double Kiv = knu * nu *Math.cos(lat); double Kv = knu * Math.pow(Math.cos(lat),3)*(nu/6)*(1-Math.pow(Math.tan(lat),2)+e2*Math.pow(Math.cos(lat),2)); double UTMni = (Ki+Kii*Math.pow(pii, 2)+ Kiii * Math.pow(pii,4)); double UTMei = 500000 + (Kiv*pii + Kv * Math.pow(pii, 3)); UTMn = (int) UTMni; UTMe = (int) UTMei; } [/code] On Thursday, October 11, 2012 2:12:50 AM UTC+2, Lew wrote: > > Karl Kristian Markman wrote: > >> I figured as much. >> >> I hav found the forumla but Im not sure how to use the formula in code. I >> mean do I just put the numbers and calculations in or do I need a special >> syntax for things like sinus and cosinus? >> > > It's a good idea to know the Java API. To this end, bookmark the API docs, > which > for Android are at > http://developer.android.com/reference/packages.html > > You should be especially familiar with the java.lang and java.util packages > http://developer.android.com/reference/java/lang/package-summary.html > http://developer.android.com/reference/java/util/package-summary.html > > For sine and cosine you want: > http://developer.android.com/reference/java/lang/Math.html > > It's kind of hard to program for Android if you don't know Java. > http://docs.oracle.com/javase/tutorial/ > > -- > Lew > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en