From f2cd8cf9eeefd7c1d546ee41d7862ee9016a20c4 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 18 Apr 2013 13:13:32 +0200 Subject: [PATCH] can pass starting lat/lon/zoom to googlemap --- plugins/googlemap/googlemap.js | 5 +++-- plugins/googlemap/googlemap.py | 8 ++++++-- trash/sliceview.py | 6 +++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/plugins/googlemap/googlemap.js b/plugins/googlemap/googlemap.js index 607d6589..326bf92b 100644 --- a/plugins/googlemap/googlemap.js +++ b/plugins/googlemap/googlemap.js @@ -29,9 +29,10 @@ $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 } diff --git a/plugins/googlemap/googlemap.py b/plugins/googlemap/googlemap.py index ac2c7982..d6ea883a 100644 --- a/plugins/googlemap/googlemap.py +++ b/plugins/googlemap/googlemap.py @@ -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', ] diff --git a/trash/sliceview.py b/trash/sliceview.py index ec43a442..7cbb4f9e 100644 --- a/trash/sliceview.py +++ b/trash/sliceview.py @@ -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, -- 2.43.0