1 |
aurelien |
1 |
<?
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
if (!sizeof($erreurs)>0) {
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
//Récupération des info de la station
|
|
|
8 |
|
|
|
9 |
//FONCTIONNEMENT_TESTE_ET_OK
|
|
|
10 |
|
|
|
11 |
$requete_station = mysql_query("select STATION_ID, STATION_NOM, STATION_LATITUDE, STATION_LONGITUDE, STATION_ALTITUDE, STATION_ENVIRONNEMENT_ID from STATION where STATION.STATION_ID=".$_SESSION['observation']['station_id']);
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
while ($station = mysql_fetch_assoc($requete_station)) {
|
|
|
15 |
|
|
|
16 |
$stations [] = $station;
|
|
|
17 |
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
$init_lat=$stations[0]['STATION_LATITUDE'];
|
|
|
21 |
$init_lon=$stations[0]['STATION_LONGITUDE'];
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
/***** Selection des stations *****/
|
|
|
27 |
|
|
|
28 |
//Affichage des éventuelles erreurs
|
|
|
29 |
afficherErreurs($erreurs);
|
|
|
30 |
|
|
|
31 |
echo "Modification de la station <b>".$stations[0]['STATION_NOM']."</b><br>";
|
|
|
32 |
|
|
|
33 |
?>
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
<div id="map" style="width:600px;height:400px;border:2px solid grey;margin:10px 0;clear:both;"></div>
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
<form id="form_coordonnee" action="<?= $url_page ?>" method="post" style="float:left;">
|
|
|
46 |
<input id="ll_latitude" name="ll_latitude" type="hidden" value="" />
|
|
|
47 |
<input id="ll_latitude_dms" name="ll_latitude_dms" type="hidden" value="" />
|
|
|
48 |
<input id="ll_longitude" name="ll_longitude" type="hidden" value="" />
|
|
|
49 |
<input id="ll_longitude_dms" name="ll_longitude_dms" type="hidden" value="" />
|
|
|
50 |
<input id="ll_altitude" name="ll_altitude" type="hidden" value="" />
|
|
|
51 |
<input id="form_coordonnee_valider" name="annul_modif" class="submit" type="submit" value="Retour" />
|
|
|
52 |
<input type="hidden" name="etape" value="1">
|
|
|
53 |
<input type="hidden" name="provenance" value="<?= $provenance ?>">
|
|
|
54 |
</li>
|
|
|
55 |
</ul>
|
|
|
56 |
|
|
|
57 |
</form>
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
<?php
|
|
|
61 |
|
|
|
62 |
include_once 'modules/configuration/car_config.inc.php' ;
|
|
|
63 |
|
|
|
64 |
if (PARTICIPANT_EST_ADULTE) {
|
|
|
65 |
?>
|
|
|
66 |
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAnm2MSMmwsDuoh7THcVDnlBQH9AL26AfEfaraxwo1G6_adyVjPRRQE4Gx2u7MomK9DJWf9kMLJ9y-ZA" type="text/javascript"></script>
|
|
|
67 |
<?php
|
|
|
68 |
}
|
|
|
69 |
else {
|
|
|
70 |
?>
|
|
|
71 |
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAFMANWib9GSm7T4W6AN9qzxRmHYqXwt_BUwczny2vFmnHz3sr3BTy_SMRJ-NzWXDUynHHSWQ7_aEZ6Q" type="text/javascript"></script>
|
|
|
72 |
<?php
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
// Centrage initial : premiere station ou ville d'inscription
|
|
|
76 |
|
|
|
77 |
echo "<script type=\"text/javascript\">";
|
|
|
78 |
echo "\n//<![CDATA[\n";
|
|
|
79 |
echo "var init_lat = ".$init_lat.";\n";
|
|
|
80 |
echo "var init_long = ".$init_lon.";\n";
|
|
|
81 |
|
|
|
82 |
?>
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
var largeur_carte = 690;
|
|
|
86 |
var haureur_retrait = 330;
|
|
|
87 |
|
|
|
88 |
var init_zoom = 10;
|
|
|
89 |
|
|
|
90 |
// Contient la carte GoogleMap
|
|
|
91 |
var map;
|
|
|
92 |
// Contient l'utilitaire permettant de trouver une adresse.
|
|
|
93 |
var EfGeocoder;
|
|
|
94 |
// Point de l'adresse saisie et à passer au GeoCoder
|
|
|
95 |
var addrpnt;
|
|
|
96 |
// L'icône à afficher sur la carte
|
|
|
97 |
var icon;
|
|
|
98 |
|
|
|
99 |
function load() {
|
|
|
100 |
// Vérification de la compatibilité du navigateur
|
|
|
101 |
if (GBrowserIsCompatible()) {
|
|
|
102 |
// Création de la carte
|
|
|
103 |
map = new GMap2(document.getElementById("map"));
|
|
|
104 |
// Positionnement de la carte
|
|
|
105 |
map.setCenter(new GLatLng(init_lat, init_long), init_zoom);
|
|
|
106 |
// Types de carte disponibles :
|
|
|
107 |
map.addMapType(G_NORMAL_MAP);
|
|
|
108 |
map.addMapType(G_SATELLITE_MAP);
|
|
|
109 |
map.addMapType(G_PHYSICAL_MAP);
|
|
|
110 |
// Bouton pour changer de type de carte (mixte, satellite, plan)
|
|
|
111 |
map.addControl(new GMapTypeControl(1));
|
|
|
112 |
// Définition du type de la carte par défaut
|
|
|
113 |
map.setMapType(G_HYBRID_MAP);
|
|
|
114 |
// Bouton large de déplancement et zoom apparaissant dans le coin haut gauche
|
|
|
115 |
map.addControl(new GLargeMapControl());
|
|
|
116 |
// Pour hierarchiser les types de carte --> pas encore dans la version stable...
|
|
|
117 |
//var mapControl = new GHierarchicalMapTypeControl();
|
|
|
118 |
// Définition des relations des types de menus
|
|
|
119 |
//mapControl.clearRelationships();
|
|
|
120 |
//mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, 'Labels', false);
|
|
|
121 |
// Ajout du controle après avoir spécifié les relations
|
|
|
122 |
//map.addControl(mapControl);
|
|
|
123 |
// Vue d'ensemble apparaissant dans le coin bas droit
|
|
|
124 |
var EfOverViewMap = new GOverviewMapControl();
|
|
|
125 |
map.addControl(EfOverViewMap);
|
|
|
126 |
var mini = EfOverViewMap.getOverviewMap();
|
|
|
127 |
// ?
|
|
|
128 |
map.enableContinuousZoom();
|
|
|
129 |
// Zoom avec la molette de la souris
|
|
|
130 |
map.enableScrollWheelZoom();
|
|
|
131 |
// Zoom avec le double clic de la souris
|
|
|
132 |
map.enableDoubleClickZoom();
|
|
|
133 |
|
|
|
134 |
// Création du GéoCoder
|
|
|
135 |
EfGeocoder = new GClientGeocoder() ;
|
|
|
136 |
|
|
|
137 |
// Icone station enregistrees (vert)
|
|
|
138 |
icon = new GIcon();
|
|
|
139 |
icon.image = "http://www.google.com/mapfiles/ms/micons/green-dot.png";
|
|
|
140 |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
|
|
141 |
icon.iconSize = new GSize(34, 34);
|
|
|
142 |
icon.shadowSize = new GSize(37, 34);
|
|
|
143 |
icon.iconAnchor = new GPoint(16, 34);
|
|
|
144 |
// Pour affichage infobulle
|
|
|
145 |
icon.infoWindowAnchor = new GPoint(5,1);
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
// Icone nouvelle station (rouge) ou station en modification
|
|
|
149 |
Nicon = new GIcon();
|
|
|
150 |
Nicon.image = "http://www.google.com/mapfiles/ms/micons/red-dot.png";
|
|
|
151 |
Nicon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
|
|
152 |
Nicon.iconSize = new GSize(34, 34);
|
|
|
153 |
Nicon.shadowSize = new GSize(37, 34);
|
|
|
154 |
Nicon.iconAnchor = new GPoint(16, 34);
|
|
|
155 |
// Pour affichage infobulle
|
|
|
156 |
Nicon.infoWindowAnchor = new GPoint(5,1);
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
// Creates a marker at the given point with the given number label
|
|
|
162 |
|
|
|
163 |
function createMarker(point, text, altitude) {
|
|
|
164 |
var marker = new GMarker(point,icon);
|
|
|
165 |
var html = text;
|
|
|
166 |
GEvent.addListener(marker, "click", function() {
|
|
|
167 |
map.setCenter(marker.getPoint());
|
|
|
168 |
afficherInfo(marker.getPoint());
|
|
|
169 |
afficherMasque(marker,text,altitude);
|
|
|
170 |
});
|
|
|
171 |
return marker;
|
|
|
172 |
}
|
|
|
173 |
|
|
|
174 |
// Affichage de la station a modifier
|
|
|
175 |
|
|
|
176 |
<? foreach($stations as $station) { ?>
|
|
|
177 |
|
|
|
178 |
var position = new GLatLng(<?= $station['STATION_LATITUDE'] ?>, <?= $station['STATION_LONGITUDE'] ?>);
|
|
|
179 |
placerMarkeur(position,"<?= $station['STATION_NOM'] ?>");
|
|
|
180 |
map.setCenter(position, 14);
|
|
|
181 |
<? } ?>
|
|
|
182 |
|
|
|
183 |
|
|
|
184 |
}
|
|
|
185 |
}
|
|
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
// Ajout d'un nouveau marqueur dragable , depuis le geocodage uniquement (blocage du clic depuis la carte)
|
|
|
191 |
|
|
|
192 |
function placerMarkeur(position,nom) {
|
|
|
193 |
if (addrpnt) {
|
|
|
194 |
map.removeOverlay(addrpnt);
|
|
|
195 |
}
|
|
|
196 |
addrpnt = new GMarker(position, {icon: Nicon, draggable: true, title: 'Click sur la carte!'}) ;
|
|
|
197 |
addrpnt.enableDragging() ;
|
|
|
198 |
map.addOverlay(addrpnt) ;
|
|
|
199 |
GEvent.addListener(addrpnt,'dragend',function() {
|
|
|
200 |
map.setCenter(addrpnt.getPoint());
|
|
|
201 |
afficherInfo(addrpnt.getPoint());
|
|
|
202 |
afficherMasque(addrpnt,nom);
|
|
|
203 |
|
|
|
204 |
}) ;
|
|
|
205 |
|
|
|
206 |
GEvent.addListener(addrpnt, "click", function() {
|
|
|
207 |
map.setCenter(addrpnt.getPoint());
|
|
|
208 |
afficherInfo(addrpnt.getPoint());
|
|
|
209 |
afficherMasque(addrpnt,nom);
|
|
|
210 |
});
|
|
|
211 |
|
|
|
212 |
afficherInfo(position);
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
// Masque de mise a jour station :
|
|
|
216 |
|
|
|
217 |
function afficherMasque(position,nom,altitude) {
|
|
|
218 |
|
|
|
219 |
// On recupere les données du formulaire (caché) , notamment pour traiter simplement l'appel asynchrone de recup altitude
|
|
|
220 |
|
|
|
221 |
var html = "<table>";
|
|
|
222 |
|
|
|
223 |
html = html + "<tr><td>Station</td> <td><input type='text' id='nom_station' value='" + nom + "'/> </td> </tr>";
|
|
|
224 |
|
|
|
225 |
<?
|
|
|
226 |
$requete_environnement = mysql_query("select ENVIRONNEMENT_ID, ENVIRONNEMENT_NOM from ENVIRONNEMENT");
|
|
|
227 |
?>
|
|
|
228 |
|
|
|
229 |
html = html + "<tr><td>Environnement :</td>";
|
|
|
230 |
html = html + "<td><select id='environnement_id' name='environnement'>";
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
<? while ($env = mysql_fetch_row($requete_environnement)) { ?>
|
|
|
234 |
html = html + "<option value='<?= $env[0] ?>'<? if ($env[0]==$stations[0]['STATION_ENVIRONNEMENT_ID']) {echo 'SELECTED';}?> ><?= $env[1] ?>";
|
|
|
235 |
|
|
|
236 |
<? } ?>
|
|
|
237 |
|
|
|
238 |
html = html + "</select></td></tr>";
|
|
|
239 |
|
|
|
240 |
html = html + "<tr><td>Latitude :</td> <td>" +document.getElementById('ll_latitude').value + "</td> </tr>" ;
|
|
|
241 |
html = html + "<tr><td>Longitude :</td> <td>" + document.getElementById('ll_longitude').value + "</td> </tr>";
|
|
|
242 |
if (altitude) {
|
|
|
243 |
html = html + "<tr><td>Altitude :</td> <td>" + altitude + "</td> </tr>";
|
|
|
244 |
}
|
|
|
245 |
else {
|
|
|
246 |
html = html + "<tr><td>Altitude :</td> <td>" + document.getElementById('ll_altitude').value + "</td> </tr>";
|
|
|
247 |
}
|
|
|
248 |
|
|
|
249 |
html = html + "<tr><td></td><td><input type='button' value='Enregistrer' onclick='saveData(false)'/></td></tr>";
|
|
|
250 |
|
|
|
251 |
html = html + "<tr><td></td><td><input type='button' value='Supprimer' onclick='saveData(true)'/></td></tr>";
|
|
|
252 |
|
|
|
253 |
position.openInfoWindow(html);
|
|
|
254 |
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
|
|
|
258 |
// Sauvegarde modification station
|
|
|
259 |
|
|
|
260 |
//
|
|
|
261 |
|
|
|
262 |
|
|
|
263 |
function saveData(suppr) {
|
|
|
264 |
|
|
|
265 |
var nom_station = escape(document.getElementById("nom_station").value);
|
|
|
266 |
var lat_station = document.getElementById("ll_latitude").value;
|
|
|
267 |
var lon_station = document.getElementById("ll_longitude").value;
|
|
|
268 |
var alt_station = document.getElementById("ll_altitude").value;
|
|
|
269 |
var environnement_id = document.getElementById("environnement_id").value;
|
|
|
270 |
|
|
|
271 |
if (!suppr) {
|
|
|
272 |
var url = "modules/observations/sauvegarde_station.php?nom_station=" + nom_station + "&action=U" + "&lat_station=" + lat_station +
|
|
|
273 |
"&lon_station=" + lon_station + "&environnement_id=" + environnement_id + "&alt_station=" + alt_station + "&participant_id=<?= $_SESSION['participant'] ?>" + "&station_id=<?= $_SESSION['observation']['station_id'] ?>";
|
|
|
274 |
}
|
|
|
275 |
else {
|
|
|
276 |
var url = "modules/observations/sauvegarde_station.php?nom_station=" + nom_station + "&action=D" + "&lat_station=" + lat_station +
|
|
|
277 |
"&lon_station=" + lon_station + "&environnement_id=" + environnement_id + "&alt_station=" + alt_station + "&participant_id=<?= $_SESSION['participant'] ?>" + "&station_id=<?= $_SESSION['observation']['station_id'] ?>";
|
|
|
278 |
}
|
|
|
279 |
|
|
|
280 |
GDownloadUrl(url, function(data, responseCode) {
|
|
|
281 |
if (responseCode == 200 && data.length <= 1) {
|
|
|
282 |
window.location = "<?= $url_page ?>";
|
|
|
283 |
}
|
|
|
284 |
});
|
|
|
285 |
}
|
|
|
286 |
|
|
|
287 |
function afficherInfo(position) {
|
|
|
288 |
var form = document.getElementById('form_coordonnee');
|
|
|
289 |
afficherCoordonnees(position.lat().toString(), position.lng().toString());
|
|
|
290 |
}
|
|
|
291 |
|
|
|
292 |
function afficherCoordonnees(lati, longi) {
|
|
|
293 |
var ellipsoid = 21;// 21 = WGS-84 (voir geo_constants)
|
|
|
294 |
var xtm = 0;// 0 = UTM et 1= MTM
|
|
|
295 |
var Coordonnee = calculer_coordonnee(lati, longi, ellipsoid, xtm);
|
|
|
296 |
|
|
|
297 |
// Nous affichons des informations.
|
|
|
298 |
document.getElementById('ll_latitude').value = Coordonnee.latitude.toFixed(4);
|
|
|
299 |
document.getElementById('ll_longitude').value = Coordonnee.longitude.toFixed(4);
|
|
|
300 |
document.getElementById('ll_latitude_dms').value = Coordonnee.latitude_dms;
|
|
|
301 |
document.getElementById('ll_longitude_dms').value = Coordonnee.longitude_dms;
|
|
|
302 |
|
|
|
303 |
// Calcul altitude
|
|
|
304 |
var script = document.createElement('script');
|
|
|
305 |
document.body.appendChild(script);
|
|
|
306 |
script.src = 'http://ws.geonames.org/' + "srtm3" + 'JSON?lat=' + lati + '&lng=' + longi + '&callback=GetAltitude';
|
|
|
307 |
|
|
|
308 |
|
|
|
309 |
}
|
|
|
310 |
|
|
|
311 |
function GetAltitude(result ) {
|
|
|
312 |
document.getElementById('ll_altitude').value = result.srtm3;
|
|
|
313 |
}
|
|
|
314 |
|
|
|
315 |
window.onload = load
|
|
|
316 |
window.onunload = GUnload
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
/* Source : Code provenant du site http://pages.globetrotter.net/roule/utmgoogle.htm
|
|
|
320 |
*/
|
|
|
321 |
|
|
|
322 |
var deg2rad = Math.PI / 180;
|
|
|
323 |
|
|
|
324 |
/*
|
|
|
325 |
* Fonction de transformation de coordonnées géographiques entre ellipsoide.
|
|
|
326 |
* Source : http://home.hiwaay.net/~taylorc/bookshelf/math-science/geodesy/datum/transform/molodensky/
|
|
|
327 |
* Licence : "The source code in the listing below may be copied and reused without restriction, but it is offered AS-IS with NO WARRANTY."
|
|
|
328 |
*
|
|
|
329 |
* Parameters:
|
|
|
330 |
* from: The geodetic position to be translated. (objet : GeodeticPosition)
|
|
|
331 |
* from_a: The semi-major axis of the "from" ellipsoid. (double)
|
|
|
332 |
* from_f: Flattening of the "from" ellipsoid. (double)
|
|
|
333 |
* from_esq: Eccentricity-squared of the "from" ellipsoid. (double)
|
|
|
334 |
* da: Change in semi-major axis length (meters); "to" minus "from"
|
|
|
335 |
* df: Change in flattening; "to" minus "from" (double)
|
|
|
336 |
* dx: Change in x between "from" and "to" datum. (double)
|
|
|
337 |
* dy: Change in y between "from" and "to" datum. (double)
|
|
|
338 |
* dz: Change in z between "from" and "to" datum. (double)
|
|
|
339 |
*
|
|
|
340 |
* Paramêtres :
|
|
|
341 |
* from : l'objet GeodesiquePosition à transformer (contient latitute, longitude et hauteur)
|
|
|
342 |
* from_a : le demi grand axe (=a) de l'ellipsoïde utilisé pour la position géodésique contenu dans l'objet "from".
|
|
|
343 |
* from_f : l'applatissement (=f) = 1/valeur... de l'ellipsoïde de l'objet "from"
|
|
|
344 |
* from_esq : l'excentricité au carré de l'ellipsoïde de l'objet "from"
|
|
|
345 |
* da : différence de demi grand axe (en metres) entre l'ellipsoïde "to" et "from".
|
|
|
346 |
* df : différence d'applatissement entre l'ellipsoïde "to" et "from".
|
|
|
347 |
* dx : différence pour l'axe x entre l'ellipsoïde "to" et "from".
|
|
|
348 |
* dy : différence pour l'axe y entre l'ellipsoïde "to" et "from".
|
|
|
349 |
* dz : différence pour l'axe z entre l'ellipsoïde "to" et "from".
|
|
|
350 |
*/
|
|
|
351 |
function transform(from, from_a, from_f, from_esq, da, df, dx, dy, dz) {
|
|
|
352 |
var slat = Math.sin (from.lat);
|
|
|
353 |
var clat = Math.cos (from.lat);
|
|
|
354 |
var slon = Math.sin (from.lon);
|
|
|
355 |
var clon = Math.cos (from.lon);
|
|
|
356 |
var ssqlat = slat * slat;
|
|
|
357 |
// "a divided by b"
|
|
|
358 |
var adb = 1.0 / (1.0 - from_f);
|
|
|
359 |
var dlat, dlon, dh;
|
|
|
360 |
|
|
|
361 |
var rn = from_a / Math.sqrt (1.0 - from_esq * ssqlat);
|
|
|
362 |
var rm = from_a * (1. - from_esq) / Math.pow ((1.0 - from_esq * ssqlat), 1.5);
|
|
|
363 |
|
|
|
364 |
dlat = (((((-dx * slat * clon - dy * slat * slon) + dz * clat) + (da * ((rn * from_esq * slat * clat) / from_a))) + (df * (rm * adb + rn / adb) * slat * clat))) / (rm + from.h);
|
|
|
365 |
|
|
|
366 |
dlon = (-dx * slon + dy * clon) / ((rn + from.h) * clat);
|
|
|
367 |
|
|
|
368 |
dh = (dx * clat * clon) + (dy * clat * slon) + (dz * slat) - (da * (from_a / rn)) + ((df * rn * ssqlat) / adb);
|
|
|
369 |
|
|
|
370 |
// Retour des données sous forme d'objet
|
|
|
371 |
var GeodeticPosition = { lon: from.lon + dlon,
|
|
|
372 |
lat: from.lat + dlat,
|
|
|
373 |
h: from.h + dh
|
|
|
374 |
};
|
|
|
375 |
|
|
|
376 |
return GeodeticPosition;
|
|
|
377 |
}
|
|
|
378 |
|
|
|
379 |
function test_transform() {
|
|
|
380 |
var PositionNtf = { lon: 7.7372, lat: 48.6, h: 0 };
|
|
|
381 |
var PositionWGS84 = transform(PositionNtf, 6378249.2, 0.00340755, 0.0068034881, -112.2, 0.00005474, -168, -60, 320);
|
|
|
382 |
alert('Longitude : ' + PositionWGS84.lon + 'Latitude : ' + PositionWGS84.lat + 'Hauteur : ' + PositionWGS84.h);
|
|
|
383 |
}
|
|
|
384 |
|
|
|
385 |
// Indiquer l'ellipsoid par son index dans le table et pour le xtm mettre 0 pour l'UTM et 1 pour le MTM (?)
|
|
|
386 |
function geo_constants(ellipsoid, xtm) {
|
|
|
387 |
// returns ellipsoid values
|
|
|
388 |
ellipsoid_axis = new Array(); // valeur du demi grand axe (a) de l'ellipsoïde
|
|
|
389 |
ellipsoid_eccen = new Array(); // valeur de l'excentricité au carré (e²) de l'ellipsoïde
|
|
|
390 |
ellipsoid_axis[0] = 6377563.396; ellipsoid_eccen[0] = 0.00667054; //airy
|
|
|
391 |
ellipsoid_axis[1] = 6377340.189; ellipsoid_eccen[1] = 0.00667054; // mod airy
|
|
|
392 |
ellipsoid_axis[2] = 6378160; ellipsoid_eccen[2] = 0.006694542; //aust national
|
|
|
393 |
ellipsoid_axis[3] = 6377397.155; ellipsoid_eccen[3] = 0.006674372; //bessel 1841
|
|
|
394 |
ellipsoid_axis[4] = 6378206.4; ellipsoid_eccen[4] = 0.006768658; //clarke 1866 == NAD 27 (TBC)
|
|
|
395 |
ellipsoid_axis[5] = 6378249.145; ellipsoid_eccen[5] = 0.006803511; //clarke 1880
|
|
|
396 |
ellipsoid_axis[6] = 6377276.345; ellipsoid_eccen[6] = 0.00637847; //everest
|
|
|
397 |
ellipsoid_axis[7] = 6377304.063; ellipsoid_eccen[7] = 0.006637847; // mod everest
|
|
|
398 |
ellipsoid_axis[8] = 6378166; ellipsoid_eccen[8] = 0.006693422; //fischer 1960
|
|
|
399 |
ellipsoid_axis[9] = 6378150; ellipsoid_eccen[9] = 0.006693422; //fischer 1968
|
|
|
400 |
ellipsoid_axis[10] = 6378155; ellipsoid_eccen[10] = 0.006693422; // mod fischer
|
|
|
401 |
ellipsoid_axis[11] = 6378160; ellipsoid_eccen[11] = 0.006694605; //grs 1967
|
|
|
402 |
ellipsoid_axis[12] = 6378137; ellipsoid_eccen[12] = 0.00669438; // grs 1980
|
|
|
403 |
ellipsoid_axis[13] = 6378200; ellipsoid_eccen[13] = 0.006693422; // helmert 1906
|
|
|
404 |
ellipsoid_axis[14] = 6378270; ellipsoid_eccen[14] = 0.006693422; // hough
|
|
|
405 |
ellipsoid_axis[15] = 6378388; ellipsoid_eccen[15] = 0.00672267; // int24
|
|
|
406 |
ellipsoid_axis[16] = 6378245; ellipsoid_eccen[16] = 0.006693422; // krassovsky
|
|
|
407 |
ellipsoid_axis[17] = 6378160; ellipsoid_eccen[17] = 0.006694542; // s america
|
|
|
408 |
ellipsoid_axis[18] = 6378165; ellipsoid_eccen[18] = 0.006693422; // wgs-60
|
|
|
409 |
ellipsoid_axis[19] = 6378145; ellipsoid_eccen[19] = 0.006694542; // wgs-66
|
|
|
410 |
ellipsoid_axis[20] = 6378135; ellipsoid_eccen[20] = 0.006694318; // wgs-72
|
|
|
411 |
ellipsoid_axis[21] = 6378137; ellipsoid_eccen[21] = 0.00669438; //wgs-84 (et NAD83 : pourquoi mis avec WGS84 ?)
|
|
|
412 |
|
|
|
413 |
if (ellipsoid == 0) {
|
|
|
414 |
ellipsoid = 22;
|
|
|
415 |
}
|
|
|
416 |
|
|
|
417 |
--ellipsoid; // table indexed differently
|
|
|
418 |
|
|
|
419 |
if (xtm == 1) {
|
|
|
420 |
// WAS: if (ellipsoid > 22)
|
|
|
421 |
scaleTm = 0.9999;
|
|
|
422 |
eastingOrg = 304800.;
|
|
|
423 |
} else {
|
|
|
424 |
scaleTm = 0.9996;
|
|
|
425 |
eastingOrg = 500000.;
|
|
|
426 |
}
|
|
|
427 |
|
|
|
428 |
// Retour des données sous forme d'objet
|
|
|
429 |
var ellipsoid = { axis: ellipsoid_axis[ellipsoid],
|
|
|
430 |
eccentricity: ellipsoid_eccen[ellipsoid],
|
|
|
431 |
eastingOrg: eastingOrg,
|
|
|
432 |
scaleTm: scaleTm
|
|
|
433 |
};
|
|
|
434 |
return ellipsoid;
|
|
|
435 |
}
|
|
|
436 |
|
|
|
437 |
/**This routine determines the correct UTM letter designator for the given latitude
|
|
|
438 |
* returns 'Z' if latitude is outside the UTM limits of 84N to 80S
|
|
|
439 |
*/
|
|
|
440 |
function get_zoneletter(lat) {
|
|
|
441 |
var zoneletter;
|
|
|
442 |
if ((84 >= lat) && (lat >= 72)) zoneletter = 'X';
|
|
|
443 |
else if ((72 > lat) && (lat >= 64)) zoneletter = 'W';
|
|
|
444 |
else if ((64 > lat) && (lat >= 56)) zoneletter = 'V';
|
|
|
445 |
else if ((56 > lat) && (lat >= 48)) zoneletter = 'U';
|
|
|
446 |
else if ((48 > lat) && (lat >= 40)) zoneletter = 'T';
|
|
|
447 |
else if ((40 > lat) && (lat >= 32)) zoneletter = 'S';
|
|
|
448 |
else if ((32 > lat) && (lat >= 24)) zoneletter = 'R';
|
|
|
449 |
else if ((24 > lat) && (lat >= 16)) zoneletter = 'Q';
|
|
|
450 |
else if ((16 > lat) && (lat >= 8)) zoneletter = 'P';
|
|
|
451 |
else if (( 8 > lat) && (lat >= 0)) zoneletter = 'N';
|
|
|
452 |
else if (( 0 > lat) && (lat >= -8)) zoneletter = 'M';
|
|
|
453 |
else if ((-8> lat) && (lat >= -16)) zoneletter = 'L';
|
|
|
454 |
else if ((-16 > lat) && (lat >= -24)) zoneletter = 'K';
|
|
|
455 |
else if ((-24 > lat) && (lat >= -32)) zoneletter = 'J';
|
|
|
456 |
else if ((-32 > lat) && (lat >= -40)) zoneletter = 'H';
|
|
|
457 |
else if ((-40 > lat) && (lat >= -48)) zoneletter = 'G';
|
|
|
458 |
else if ((-48 > lat) && (lat >= -56)) zoneletter = 'F';
|
|
|
459 |
else if ((-56 > lat) && (lat >= -64)) zoneletter = 'E';
|
|
|
460 |
else if ((-64 > lat) && (lat >= -72)) zoneletter = 'D';
|
|
|
461 |
else if ((-72 > lat) && (lat >= -80)) zoneletter = 'C';
|
|
|
462 |
else zoneletter = chr(32 + 66); //This is here as an error flag to show that the Latitude is outside the UTM limits
|
|
|
463 |
return zoneletter;
|
|
|
464 |
}
|
|
|
465 |
|
|
|
466 |
function parseCoordinate(coordinate, type, format, spaced) {
|
|
|
467 |
var coordd;
|
|
|
468 |
var coordm;
|
|
|
469 |
var coords;
|
|
|
470 |
var coordh = 0;
|
|
|
471 |
|
|
|
472 |
if (coordinate.search(/(^ *-|[WOS])/i) >= 0) {
|
|
|
473 |
coordh = -1;
|
|
|
474 |
}
|
|
|
475 |
if (coordinate.search(/(^ *\+|[NE])/i) >= 0) {
|
|
|
476 |
coordh = 1;
|
|
|
477 |
}
|
|
|
478 |
|
|
|
479 |
// if (coordinate.search(/[EW]/i) >= 0 && !type) { type = 'lon'; }
|
|
|
480 |
// if (coordinate.search(/[NS]/i) >= 0 && !type) { type = 'lat'; }
|
|
|
481 |
|
|
|
482 |
coordinate = coordinate.replace(/,/g, '.'); // french commas
|
|
|
483 |
// not sure really needed.
|
|
|
484 |
coordinate = coordinate.replace(/[NESWO+\-]/gi,' '); // add also: °, ', " -- or replace everything that is not a number or a dot
|
|
|
485 |
|
|
|
486 |
// alert("coordinate = " + coordinate);
|
|
|
487 |
if (coordinate.search(/[0-9]/i) < 0) {
|
|
|
488 |
alert("Can't parse input field");
|
|
|
489 |
coordd = "";
|
|
|
490 |
return;
|
|
|
491 |
}
|
|
|
492 |
|
|
|
493 |
// http://www.gpsvisualizer.com/calculators
|
|
|
494 |
// http://www.javascriptkit.com/javatutors/redev2.shtml
|
|
|
495 |
var parts = coordinate.match(/([0-9\.\-]+)[^0-9\.]*([0-9\.]+)?[^0-9\.]*([0-9\.]+)?/);
|
|
|
496 |
// / (one or more) /
|
|
|
497 |
// ([0-9\.\-]+) digits, dot or -, one set
|
|
|
498 |
// [^0-9\.]* separator
|
|
|
499 |
// ([0-9\.]+)? digits, dot, zero or one set
|
|
|
500 |
// [^0-9\.]* separator
|
|
|
501 |
// ([0-9\.]+)? digits, dot, zero or one set
|
|
|
502 |
|
|
|
503 |
// *: 0|more +: 1|more ?: 0|1 http://www.javascriptkit.com/javatutors/redev2.shtml
|
|
|
504 |
if (!parts[1]) {
|
|
|
505 |
alert("Can't parse input field");
|
|
|
506 |
coordd = '';
|
|
|
507 |
return;
|
|
|
508 |
} else {
|
|
|
509 |
coordd = parts[1];
|
|
|
510 |
if (parts[2]) {
|
|
|
511 |
coordm = parts[2];
|
|
|
512 |
} else {
|
|
|
513 |
coordm = 0;
|
|
|
514 |
}
|
|
|
515 |
if (parts[3]) {
|
|
|
516 |
coords = parts[3];
|
|
|
517 |
} else {
|
|
|
518 |
coords = 0;
|
|
|
519 |
}
|
|
|
520 |
// n = parseFloat(parts[1]);
|
|
|
521 |
// if (parts[2]) { n = n + parseFloat(parts[2])/60; }
|
|
|
522 |
// if (parts[3]) { n = n + parseFloat(parts[3])/3600; }
|
|
|
523 |
}
|
|
|
524 |
|
|
|
525 |
// Retour des données sous forme d'objet
|
|
|
526 |
var Coordonnee = { coordd: coordd,
|
|
|
527 |
coordm: coordm,
|
|
|
528 |
coords: coords,
|
|
|
529 |
coordh: coordh
|
|
|
530 |
};
|
|
|
531 |
return Coordonnee;
|
|
|
532 |
}
|
|
|
533 |
|
|
|
534 |
function validate_dms(latd, latm, lats, latb, lonm, lond, lons, lonb) {
|
|
|
535 |
var valid = 1;
|
|
|
536 |
if (Math.abs(Number(latd)) >= 90)
|
|
|
537 |
valid = 0;
|
|
|
538 |
if (Number(latm) >= 60)
|
|
|
539 |
valid = 0;
|
|
|
540 |
if (Number(lats) >= 60)
|
|
|
541 |
valid = 0;
|
|
|
542 |
if (Math.abs(Number(lond)) >= 180)
|
|
|
543 |
valid = 0;
|
|
|
544 |
if (Number(lonm) >= 60)
|
|
|
545 |
valid = 0;
|
|
|
546 |
if (Number(lons) >= 60)
|
|
|
547 |
valid = 0;
|
|
|
548 |
|
|
|
549 |
return(valid);
|
|
|
550 |
}
|
|
|
551 |
|
|
|
552 |
// convert decimal degrees to dms
|
|
|
553 |
function convertir_en_dms(lat, lon) {
|
|
|
554 |
var latbrg = 1;
|
|
|
555 |
var lonbrg = 2;
|
|
|
556 |
if (lat < 0)
|
|
|
557 |
latbrg = 2
|
|
|
558 |
if (lon < 0)
|
|
|
559 |
lonbrg = 1;
|
|
|
560 |
// LEW: have to round here, else could end up with 60 seconds :-)
|
|
|
561 |
var tlat = Math.abs(lat) + 0.5 / 360000; // round up 0.005 seconds (1/100th)
|
|
|
562 |
var tlon = Math.abs(lon) + 0.5 / 360000;
|
|
|
563 |
|
|
|
564 |
var tlatdm = Math.abs(lat) + 0.5 / 60000; // round up 0.0005 minutes (1/1000th)
|
|
|
565 |
var tlondm = Math.abs(lon) + 0.5 / 60000;
|
|
|
566 |
|
|
|
567 |
var deglat = Math.floor(tlat);
|
|
|
568 |
var t = (tlat - deglat) * 60;
|
|
|
569 |
var minlat = Math.floor(t);
|
|
|
570 |
|
|
|
571 |
var minlatdm = Math.floor((tlatdm - Math.floor(tlatdm)) * 60 * 1000) / 1000;
|
|
|
572 |
|
|
|
573 |
var seclat = (t - minlat) * 60;
|
|
|
574 |
seclat = Math.floor(seclat * 100) / 100; // works in js 1.4
|
|
|
575 |
// seclat = seclat.toFixed(2); // 2 decimal places js 1.5 and later
|
|
|
576 |
|
|
|
577 |
var deglon = Math.floor(tlon);
|
|
|
578 |
|
|
|
579 |
t = (tlon - deglon) * 60;
|
|
|
580 |
var minlon = Math.floor(t);
|
|
|
581 |
|
|
|
582 |
var minlondm = Math.floor((tlondm - Math.floor(tlondm)) * 60 * 1000) / 1000;
|
|
|
583 |
|
|
|
584 |
var seclon = (t - minlon) * 60;
|
|
|
585 |
seclon = Math.floor(seclon * 100) / 100; // js 1.4
|
|
|
586 |
// seclon = seclon.toFixed(2); // js 1.5 and later
|
|
|
587 |
|
|
|
588 |
var latb = '';
|
|
|
589 |
if (latbrg > 0) {
|
|
|
590 |
latb = 'N';// 1 = N (nord)
|
|
|
591 |
} else {
|
|
|
592 |
latb = 'S';// 2 = S (sud)
|
|
|
593 |
}
|
|
|
594 |
var latdms = deglat + "° " + minlat + "' " + seclat + "\"";
|
|
|
595 |
|
|
|
596 |
var lonb = '';
|
|
|
597 |
if (lonbrg > 0) {
|
|
|
598 |
lonb = 'E'; // 2 = E (est)
|
|
|
599 |
} else {
|
|
|
600 |
lonb = 'W';// 1 = W (west)
|
|
|
601 |
}
|
|
|
602 |
var londms = deglon + "° " + minlon + "' " + seclon + "\"";
|
|
|
603 |
|
|
|
604 |
var chaine_latlon_dms = latdms + ' ' + latb + ' ' + londms + ' ' + lonb;
|
|
|
605 |
|
|
|
606 |
// Retour des données sous forme d'objet
|
|
|
607 |
var LatLongDms = { lat: lat,
|
|
|
608 |
lat_degre: Math.floor(tlatdm),
|
|
|
609 |
lat_min: minlatdm,
|
|
|
610 |
lat_s: seclat,
|
|
|
611 |
lat_direction:latb,
|
|
|
612 |
lat_dms:latdms,
|
|
|
613 |
lon: lon,
|
|
|
614 |
lon_degre: Math.floor(tlondm),
|
|
|
615 |
lon_min: minlondm,
|
|
|
616 |
lon_s: seclon,
|
|
|
617 |
lon_direction:lonb,
|
|
|
618 |
lon_dms:londms,
|
|
|
619 |
ll_dms:chaine_latlon_dms
|
|
|
620 |
};
|
|
|
621 |
return LatLongDms;
|
|
|
622 |
}
|
|
|
623 |
|
|
|
624 |
function calculer_coordonnee(lati, longi, ellips, xtm) {
|
|
|
625 |
// Récupération de l'ellipsoide
|
|
|
626 |
var ellipsoid = geo_constants(ellips, xtm);
|
|
|
627 |
var axis = ellipsoid.axis;
|
|
|
628 |
var eccent = ellipsoid.eccentricity;
|
|
|
629 |
var scaleTm = ellipsoid.scaleTm;
|
|
|
630 |
var eastingOrg = ellipsoid.eastingOrg;
|
|
|
631 |
|
|
|
632 |
// Nous parsons la latitude saisie
|
|
|
633 |
var CoordonneeLat = parseCoordinate(lati);
|
|
|
634 |
var latb = '';// vide
|
|
|
635 |
if (CoordonneeLat.coordh != 0) {
|
|
|
636 |
if (CoordonneeLat.coordh > 0) {
|
|
|
637 |
latb = 'N';// 1 = N (nord)
|
|
|
638 |
} else {
|
|
|
639 |
latb = 'S';// 2 = S (sud)
|
|
|
640 |
}
|
|
|
641 |
}
|
|
|
642 |
var latd = CoordonneeLat.coordd;
|
|
|
643 |
var latm = CoordonneeLat.coordm;
|
|
|
644 |
var lats = CoordonneeLat.coords;
|
|
|
645 |
|
|
|
646 |
// Nous parsons la longitude saisie
|
|
|
647 |
var CoordonneeLon = parseCoordinate(longi);
|
|
|
648 |
var lonb = '';// vide
|
|
|
649 |
if (CoordonneeLon.coordh != 0) {
|
|
|
650 |
if (CoordonneeLon.coordh > 0) {
|
|
|
651 |
lonb = 'E'; // 2 = E (est)
|
|
|
652 |
} else {
|
|
|
653 |
lonb = 'W';// 1 = W (west)
|
|
|
654 |
}
|
|
|
655 |
}
|
|
|
656 |
var lond = CoordonneeLon.coordd;
|
|
|
657 |
var lonm = CoordonneeLon.coordm;
|
|
|
658 |
var lons = CoordonneeLon.coords;
|
|
|
659 |
|
|
|
660 |
// cope with blank fields
|
|
|
661 |
if (latd == '' || lond == '') {
|
|
|
662 |
alert("Latitude and longitude degrees must be entered");
|
|
|
663 |
return;
|
|
|
664 |
}
|
|
|
665 |
|
|
|
666 |
// Indication de la direction par défaut pour la latitude et la longitude en France
|
|
|
667 |
if (latb == '') {
|
|
|
668 |
latb = 'N';// 1 = N (Nord)
|
|
|
669 |
}
|
|
|
670 |
if (lonb == '') {
|
|
|
671 |
lonb = 'E';// 2 = E (Est)
|
|
|
672 |
}
|
|
|
673 |
|
|
|
674 |
// Validation
|
|
|
675 |
var valid = validate_dms(latd, latm, lats, latb, lonm, lond, lons, lonb);
|
|
|
676 |
if (valid == 0) {
|
|
|
677 |
alert("Invalid degrees, minutes or seconds");
|
|
|
678 |
return;
|
|
|
679 |
}
|
|
|
680 |
|
|
|
681 |
var lat = Number(latd);
|
|
|
682 |
lat = lat + Number(latm) / 60;
|
|
|
683 |
lat = lat + Number(lats) / 3600;
|
|
|
684 |
if (latb == 'S') { // 2 = S
|
|
|
685 |
lat = lat * -1;
|
|
|
686 |
}
|
|
|
687 |
var lon = Number(lond);
|
|
|
688 |
lon = lon + Number(lonm) / 60;
|
|
|
689 |
lon = lon + Number(lons) / 3600;
|
|
|
690 |
if (lonb == 'W') { // 1 = W
|
|
|
691 |
lon = lon * -1;
|
|
|
692 |
}
|
|
|
693 |
|
|
|
694 |
if (lat >= 84 || lat <= -80) {
|
|
|
695 |
alert("UTM latitudes should be between 84N and 80S\nCalculation will proceed anyway as locator will be valid.");
|
|
|
696 |
}
|
|
|
697 |
|
|
|
698 |
var k0 = scaleTm;
|
|
|
699 |
var latrad = lat * deg2rad;
|
|
|
700 |
var longrad = lon * deg2rad;
|
|
|
701 |
var zonenum = Math.floor((lon + 180) / 6) + 1;
|
|
|
702 |
// @dc (180 - (-70.5))/3 - 76
|
|
|
703 |
if (eastingOrg == 304800.) {
|
|
|
704 |
zonenum = Math.floor((180 - lon) / 3) - 76; // MTM, only in Quebec
|
|
|
705 |
if (zonenum < 3 || zonenum > 10) {
|
|
|
706 |
alert("MTM zone numbers only confirmed for 3-10, province of Quebec\nContinuing anyway");
|
|
|
707 |
}
|
|
|
708 |
}
|
|
|
709 |
|
|
|
710 |
if (lat >= 56.0 && lat < 64.0 && lon >= 3.0 && lon < 12.0 ) {
|
|
|
711 |
zonenum = 32;
|
|
|
712 |
}
|
|
|
713 |
// Zones speciales pour Svalbard
|
|
|
714 |
if( lat >= 72.0 && lat < 84.0 ) {
|
|
|
715 |
if (lon >= 0.0 && lon < 9.0 ) zonenum = 31;
|
|
|
716 |
else if ( lon >= 9.0 && lon < 21.0 ) zonenum = 33;
|
|
|
717 |
else if ( lon >= 21.0 && lon < 33.0 ) zonenum = 35;
|
|
|
718 |
else if ( lon >= 33.0 && lon < 42.0 ) zonenum = 37;
|
|
|
719 |
}
|
|
|
720 |
|
|
|
721 |
var lonorig = (zonenum - 1) * 6 - 180 + 3; //+3 puts origin in middle of zone
|
|
|
722 |
// @dc 180 - (7+76) * 3 - 1.5
|
|
|
723 |
if (eastingOrg == 304800.) {
|
|
|
724 |
lonorig = 180 - (zonenum + 76) * 3 - 1.5;
|
|
|
725 |
}
|
|
|
726 |
var lonorigrad = lonorig * deg2rad;
|
|
|
727 |
|
|
|
728 |
//Récupération de la lettre du fuseau xTM
|
|
|
729 |
var letter = get_zoneletter(lat);
|
|
|
730 |
|
|
|
731 |
// Calcul xTM
|
|
|
732 |
var eccPrimeSquared = (eccent) / (1 - eccent);
|
|
|
733 |
var N = axis / Math.sqrt(1 - eccent * Math.sin(latrad) * Math.sin(latrad));
|
|
|
734 |
var T = Math.tan(latrad) * Math.tan(latrad);
|
|
|
735 |
var C = eccPrimeSquared * Math.cos(latrad) * Math.cos(latrad);
|
|
|
736 |
var A = Math.cos(latrad) * (longrad - lonorigrad);
|
|
|
737 |
var M = axis * ((1 - eccent / 4 - 3 * eccent * eccent / 64 - 5 * eccent * eccent * eccent / 256) * latrad - (3 * eccent / 8 + 3 * eccent * eccent / 32 + 45 * eccent * eccent *eccent / 1024) * Math.sin(2 * latrad) + (15 * eccent * eccent / 256 + 45 * eccent * eccent * eccent / 1024) * Math.sin(4 * latrad) - (35 * eccent * eccent * eccent / 3072) * Math.sin(6 * latrad));
|
|
|
738 |
|
|
|
739 |
var easting = (k0 * N * (A + (1 - T + C) * A * A * A / 6 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120) + eastingOrg);
|
|
|
740 |
var northing = (k0 * (M + N * Math.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)));
|
|
|
741 |
if (lat < 0) {
|
|
|
742 |
northing += 10000000.0; //10000000 meter offset for southern hemisphere
|
|
|
743 |
}
|
|
|
744 |
|
|
|
745 |
// xTM
|
|
|
746 |
// Arrondi au nombre supérieur
|
|
|
747 |
// alert("easting = " + easting);
|
|
|
748 |
preciseEasting = easting;
|
|
|
749 |
easting = Math.floor(easting + .5);
|
|
|
750 |
// alert("easting = " + easting);
|
|
|
751 |
// alert("northing = " + northing);
|
|
|
752 |
preciseNorthing = northing;
|
|
|
753 |
northing = Math.floor(northing + .5);
|
|
|
754 |
// alert("northing = " + northing);
|
|
|
755 |
var chaine_xtm = '';
|
|
|
756 |
var x_tm = '';
|
|
|
757 |
if (eastingOrg == 304800.) {
|
|
|
758 |
chaine_xtm = zonenum + ' ' + easting + 'm E ' + northing + 'm N';
|
|
|
759 |
x_tm = 'MTM';
|
|
|
760 |
} else {
|
|
|
761 |
chaine_xtm = zonenum + letter + ' ' + easting + 'm E ' + northing + 'm N';
|
|
|
762 |
x_tm = 'UTM';
|
|
|
763 |
}
|
|
|
764 |
|
|
|
765 |
// Latitude/Longitude
|
|
|
766 |
var chaine_latlon = lat + ' ' + latb + ' ' + lon + ' ' + lonb;
|
|
|
767 |
var LatLongDms = convertir_en_dms(lat,lon);
|
|
|
768 |
|
|
|
769 |
// Retour des données sous forme d'objet
|
|
|
770 |
var Coordonnee = { xtm: x_tm,
|
|
|
771 |
nord: northing,
|
|
|
772 |
est: easting,
|
|
|
773 |
zone_numero: zonenum,
|
|
|
774 |
zone_lettre: letter,
|
|
|
775 |
xtm_chaine: chaine_xtm,
|
|
|
776 |
latitude:lat,
|
|
|
777 |
longitude:lon,
|
|
|
778 |
ll_chaine: chaine_latlon,
|
|
|
779 |
latitude_dms:LatLongDms.lat_dms,
|
|
|
780 |
longitude_dms:LatLongDms.lon_dms,
|
|
|
781 |
ll_chaine_dms: LatLongDms.ll_dms
|
|
|
782 |
};
|
|
|
783 |
return Coordonnee;
|
|
|
784 |
}
|
|
|
785 |
//]]>
|
|
|
786 |
|
|
|
787 |
</script>
|
|
|
788 |
|
|
|
789 |
<?
|
|
|
790 |
}
|
|
|
791 |
?>
|
|
|
792 |
|
|
|
793 |
|