can pass starting lat/lon/zoom to googlemap
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 18 Apr 2013 11:13:32 +0000 (13:13 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 18 Apr 2013 11:13:32 +0000 (13:13 +0200)
plugins/googlemap/googlemap.js
plugins/googlemap/googlemap.py
trash/sliceview.py

index 607d658..326bf92 100644 (file)
             $this.data('markerCluster', null);
             $this.data('markers', []);
 
-            var myLatlng = new google.maps.LatLng(34.397, 150.644);
+            console.log ("lat=" + options.latitude + " long=" + options.longitude + " and zoom=" + options.zoom);
+            var myLatlng = new google.maps.LatLng(options.latitude, options.longitude);
             var myOptions = {
-              zoom: 2,
+              zoom: options.zoom,
               center: myLatlng,
               mapTypeId: google.maps.MapTypeId.ROADMAP
             }
index ac2c798..d6ea883 100644 (file)
@@ -5,9 +5,13 @@ class GoogleMap (Plugin):
     # set checkboxes if a final column with checkboxes is desired
     # pass columns as the initial set of columns
     #   if None then this is taken from the query's fields
-    def __init__ (self, query, **settings):
+    # latitude,longitude, zoom : the starting point
+    def __init__ (self, query, latitude=43., longitude=7., zoom=4, **settings):
         Plugin.__init__ (self, **settings)
         self.query=query
+        self.latitude=latitude
+        self.longitude=longitude
+        self.zoom=zoom
 
     def template_file (self):
         return "googlemap.html"
@@ -31,4 +35,4 @@ class GoogleMap (Plugin):
         return reqs
 
     # the list of things passed to the js plugin
-    def json_settings_list (self): return ['plugin_uuid','query_uuid']
+    def json_settings_list (self): return ['plugin_uuid','query_uuid', 'latitude', 'longitude', 'zoom', ]
index ec43a44..7cbb4f9 100644 (file)
@@ -90,6 +90,10 @@ def slice_view (request, slicename=tmp_default_slice):
                         # tab's sons preferably turn this off
                         togglable=False,
                         query=main_query,
+                        # center on Paris
+                        latitude=49.,
+                        longitude=2.2,
+                        zoom=3,
                         ),
                     Raw (
 #                    SensLabMap (
@@ -110,7 +114,7 @@ if I keep this active, so for now it's disabled
                     ]),
             Hazelnut ( 
                 page=page,
-                title='not in tabs',
+                title='a hazelnut not in tabs',
                 domid='standalone',
                 # this is the query at the core of the slice list
                 query=main_query,