ça marche pas !
j'ai declaré le tabelaux globalement
double [][] StationTram1 = new double [25][2];
et je l'ai remplie comme tu ma indiquer
1 2 3 4 5 6 7 8 9
| for (int i = 0; i < jsonArray.length(); i++) {
jresponse = jsonArray.getJSONObject(i);
latitude = Double.parseDouble(jresponse.getString("lat"));
longitude = Double.parseDouble(jresponse.getString("lng"));
for(int j=0; j<StationTram1.length;j++) {
StationTram1[j][0] = Double.parseDouble(jresponse.getString("lat"));
StationTram1[j][1] = Double.parseDouble(jresponse.getString("lng"));
} |
seulement lorsque je veux calculer la distance ça marche pas
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| for(double[] point : StationTram1) {
LatLng to = new LatLng(point[0], point[1]);
//Calculating the distance in meters
int distanceLambda = (int) SphericalUtil.computeDistanceBetween(from, to);
if (distanceLambda < distance) { // cette distance est donc plus petite que la plus petite distance déjà trouvée
distance = distanceLambda;
Latitude1 = point[0];
Longitude1 = point[1];
}
} |
pourtant si je remplie le tableaux manuellement ça marche
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| double [][] StationTram = new double [25][2];
//Station Le Rocher
StationTram [0][0] = 35.2236078 ;
StationTram [0][1] = -0.6092131;
//Station Quatres Horloges
StationTram [1][0] =35.1907590 ;
StationTram [1][1] =-0.6340827 ;
//Station Petit Vichy
StationTram [2][0] = 35.1914282;
StationTram [2][1] = -0.6292730;
//Station Cascade
StationTram [3][0] = 35.2102234 ;
StationTram [3][1] = -0.6292730 ;
//Station Gare Routière Est
StationTram [4][0] =35.2128532 ;
StationTram [4][1] =-0.6139107 ;
//Station Cité Aadl Ben Hamouda
StationTram [5][0] = 35.2201147;
StationTram [5][1] = -0.6239696;
//Station Benhamouda
StationTram [6][0] =35.2174852;
StationTram [6][1] = -0.6230255;
//Station Gare Routière Nord
StationTram [7][0] = 35.2231999 ;
StationTram [7][1] = -0.6296344;
//Station Gare Ferroviaire
StationTram [8][0] = 35.2246723;
StationTram [8][1] =-0.6305786;
//Station Campus
StationTram [9][0] = 35.2206756;
StationTram [9][1] =-0.6423803;
//Station Faculté de Droit
StationTram [10][0] = 35.2163282;
StationTram [10][1] =-0.6330677;
//Station Sidi Djilali
StationTram [11][0] = 35.2161752;
StationTram [11][1] =-0.6243836;
//Station Wiaam
StationTram [12][0] = 35.2102847;
StationTram [12][1] =-0.6272590;
//Station Azzouz
StationTram [13][0] = 35.2031314;
StationTram [13][1] =-0.6254565;
//Station H.Boumedienne
StationTram [14][0] = 35.2011677;
StationTram [14][1] =-0.6191050;
//Station Sbyka
StationTram [15][0] = 35.1946448;
StationTram [15][1] =-0.6125390;
//Station Matérnité
StationTram [16][0] = 35.1927510;
StationTram [16][1] =-0.6149852;
//Station Sidi Yacine
StationTram [17][0] = 35.1926107;
StationTram [17][1] =-0.6187617;
//Station Jardin
StationTram [18][0] = 35.1904012;
StationTram [18][1] =-0.6422793;
//Station Gare Routière Sud
StationTram [19][0] = 35.1859469;
StationTram [19][1] =-0.6495749;
//Station Rectorat
StationTram [20][0] = 35.1788616;
StationTram [20][1] =-0.6600892;
//Station Institut Science Médicale
StationTram [21][0] = 35.1798438;
StationTram [21][1] =-0.6449401;
//Station BD.Amara
StationTram [22][0] =35.1802647;
StationTram [22][1] =-0.6352412;
//Station Cité 20 AOUT
StationTram [23][0] = 35.1816327;
StationTram [23][1] = -0.6267440;
////Station Mexique
StationTram [24][0] = 35.2172748 ;
StationTram [24][1] = -0.6394620; |
Partager