Parcourir la source

reduction du nombre de décimales des points GPS + remplissage de tous les champs GPS (custom_point + panorama)… de manière très sale !!

julpec il y a 8 ans
Parent
commit
1c36428534
1 fichiers modifiés avec 19 ajouts et 3 suppressions
  1. 19 3
      panorama/templates/panorama/main.html

+ 19 - 3
panorama/templates/panorama/main.html

@@ -67,17 +67,33 @@ style="padding:0px"
         map.on('move', function(e) {
         map.on('move', function(e) {
             crosshair.setLatLng(map.getCenter());
             crosshair.setLatLng(map.getCenter());
         });
         });
-
+        document.getElementById('id_latitude').setAttribute("name","custompoint_lat");
+        document.getElementById('id_longitude').setAttribute("name","custompoint_long");
+        document.getElementById('id_altitude').setAttribute("name","custompoint_alt");
         map.on('moveend', function(e) {
         map.on('moveend', function(e) {
-            var lat = map.getCenter().lat;
-            var lng = map.getCenter().lng;
+            var lat = map.getCenter().lat.toFixed(5);
+            var lng = map.getCenter().lng.toFixed(5);
             $('#id_latitude').val(lat);
             $('#id_latitude').val(lat);
+            document.getElementsByName("latitude")[0].value = lat;
             $('#id_longitude').val(lng);
             $('#id_longitude').val(lng);
+            document.getElementsByName("longitude")[0].value = lng;
             $.get("http://api.geonames.org/astergdem?lat="+lat+"&lng="+lng+"&username=celutz&style=full" ).done(
             $.get("http://api.geonames.org/astergdem?lat="+lat+"&lng="+lng+"&username=celutz&style=full" ).done(
                 function(data) {
                 function(data) {
                     $('#id_altitude').val(parseInt(data));
                     $('#id_altitude').val(parseInt(data));
+                    document.getElementsByName("altitude")[0].value = parseInt(data);
                 });
                 });
         });
         });
+/*
+map.on('moveend', function(e) {
+            var lat = map.getCenter().lat;
+            var lng = map.getCenter().lng;
+var formsList = document.getElementById( 'id_latitude' );
+for ( i = 0; i < formsList.length; i++ ) {
+    formsList[i].val(lat);
+};
+});
+*/
+
     var panoIcon = L.icon({
     var panoIcon = L.icon({
         iconUrl: '{% static "panorama/img/marker-red.png" %}',
         iconUrl: '{% static "panorama/img/marker-red.png" %}',
         iconSize: [22, 35],
         iconSize: [22, 35],