Parcourir la source

[fix] Map not exact position

ljf il y a 8 ans
Parent
commit
ced61b7d3c

+ 1 - 1
wifiwithme/apps/contribmap/templates/contribmap/map.html

@@ -9,7 +9,7 @@
 <h1>Résultats {% if private_mode %}(données privées){% endif %}</h1>
 
 <div id="map" class="results" data-json="{{ json_url }}"
-    start_lon="{{ isp.LONGITUDE }}" start_lat="{{ isp.LATITUDE }}"
+    start_lon="{{ isp.LONGITUDE|stringformat:"f" }}" start_lat="{{ isp.LATITUDE|stringformat:"f" }}"
     start_zoom="{{ isp.ZOOM }}"></div>
 
 <script src="{% static 'map.js' %}" type="text/javascript"></script>

+ 1 - 1
wifiwithme/apps/contribmap/templates/contribmap/wifi-form.html

@@ -107,7 +107,7 @@ pourraient être intéressantes.
     <div class="row">
       <div class="col-sm-6">
         <div id="map" data-json="{{geojson}}"
-            start_lon="{{ isp.LONGITUDE }}" start_lat="{{ isp.LATITUDE }}"
+            start_lon="{{ isp.LONGITUDE|stringformat:"f" }}" start_lat="{{ isp.LATITUDE|stringformat:"f" }}"
             start_zoom="{{ isp.ZOOM }}"></div>
       </div>
       <div class="form-group col-sm-6">

+ 2 - 2
wifiwithme/static/form.js

@@ -2,8 +2,8 @@ $( document ).ready(function() {
 
     // Defaults
     defaults = {
-        lat: ($('#id_latitude').val()) ? $('#id_latitude').val() : $('#map').attr("start_lat"),
-        lng: ($('#id_longitude').val()) ? $('#id_longitude').val() : $('#map').attr("start_lon"),
+        lat: ($('#id_latitude').val()) ? $('#id_latitude').val() : parseFloat($('#map').attr("start_lat")),
+        lng: ($('#id_longitude').val()) ? $('#id_longitude').val() : parseFloat($('#map').attr("start_lon")),
         zoom: $('#map').attr("start_zoom"),
     }
 

+ 2 - 2
wifiwithme/static/map.js

@@ -2,8 +2,8 @@ $( document ).ready(function() {
 
     // Defaults
     defaults = {
-        lat: $('#map').attr("start_lat"),
-        lng: $('#map').attr("start_lon"),
+        lat: parseFloat($('#map').attr("start_lat")),
+        lng: parseFloat($('#map').attr("start_lon")),
         zoom: $('#map').attr("start_zoom"),
     }