Preface: As a result of the project requirements and customer requirements to be replaced by the Baidu map to Chemleader map, so involved in the transformation of latitude and longitude, Chemleader official documents to provide less information in this area, did not find the right solution, so after some trouble is finally found a more commissioned solution.
Geographical coordinates: 437438300,134912100 (the first parameter represents the longitude, the second represents the dimension)
K Code: 8Q91F4APV
Warp Latitude: 121.42437,37.415793
(Parameters are for reference only)
Description :
Chemleader Map API to obtain geographical coordinates and K code have the corresponding API, we can enjoy the transfer, here only according to K code conversion to warp latitude
So see the demo of the conversion (Java code)
============================================================
conversion from Chemleader K code to latitude and longitude
public class Kcode {private double longitude;
private double latitude;
Private byte[] map34 = new byte[123];
Public Kcode () {map34[' 0 '] = 0;
map34[' 1 '] = 1;
map34[' 2 '] = 2;
map34[' 3 '] = 3;
map34[' 4 '] = 4;
map34[' 5 '] = 5;
map34[' 6 '] = 6;
map34[' 7 '] = 7;
map34[' 8 '] = 8;
map34[' 9 '] = 9;
Map34[' a '] = 10;
Map34[' B '] = 11;
Map34[' C '] = 12;
map34[' d '] = 13;
Map34[' e '] = 14;
map34[' f '] = 15;
Map34[' g '] = 16;
map34[' h '] = 17;
map34[' I '] = 18;
Map34[' j '] = 19;
map34[' k '] = 20;
map34[' m '] = 21;
map34[' n '] = 22;
map34[' P '] = 23;
map34[' q '] = 24;
Map34[' r '] = 25;
Map34[' s '] = 26;
map34[' t '] = 27;
map34[' u '] = 28;
map34[' V '] = 29;
map34[' W '] = 30;
map34[' x '] = 31;
map34[' y '] = 32;
Map34[' z '] = 33; } PubLIC double Getlongitude () {return longitude;
Public double Getlatitude () {return latitude;
}//private int pow34 (int i) {int sum = 1;
while (i > 0) {sum *= 34;
I.;
return sum;
}//private int convert34to10 (String str34) {int sum = 0; for (int i = 0; i < str34.length (); ++i) {if (Str34.charat (i)!= ' l ' && str34.charat (i)!=
' O ') && ((Str34.charat (i) >= ' 0 ' && str34.charat (i) <= ' 9 ') | |
(Str34.charat (i) >= ' a ' && str34.charat (i) <= ' z '))
) {sum = map34[Str34.charat (i)] * POW34 (i);
else {System.out.println ("invalid Chaa");
return-1;
return sum; }//public int COnvert (String kcode) {if (Kcode.length ()!= 9) {return-1;
int Lut,lat;
char quad = kcode.charat (0);
Switch (quad) {case ' 5 ': Lut = Convert34to10 (kcode.substring (1, 5));
lat = Convert34to10 (kcode.substring (5, 9));
Longitude = (double) Lut/(3600 * 10) + 105;
Latitude = (double) lat/(3600 * 10) + 40;
Break
Case ' 6 ': Lut = Convert34to10 (kcode.substring (1, 5));
lat = Convert34to10 (kcode.substring (5, 9));
Longitude = (double) Lut/(3600 * 10) + 70;
Latitude = (double) lat/(3600 * 10) + 40;
Break
Case ' 7 ': Lut = Convert34to10 (kcode.substring (1, 5));
lat = Convert34to10 (kcode.substring (5, 9));
Longitude = (double) Lut/(3600 * 10) + 70; Latitude = (double)Lat/(3600 * 10) + 5;
Break
Case ' 8 ': Lut = Convert34to10 (kcode.substring (1, 5));
lat = Convert34to10 (kcode.substring (5, 9));
Longitude = (double) Lut/(3600 * 10) + 105;
Latitude = (double) lat/(3600 * 10) + 5;
Break
Default:} return 0;
public static void Main (string[] args) {Kcode code = new Kcode (); Code.
Convert ("8Q91F4APV");
System.out.println (Code.getlongitude ());
System.out.println (Code.getlatitude ()); }
}
The above code is for informational purposes only.