[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] Optimizing MapOSMatic homepage load time
From: |
Thomas Petazzoni |
Subject: |
[Maposmatic-dev] Optimizing MapOSMatic homepage load time |
Date: |
Thu, 5 Nov 2009 23:20:15 +0100 |
Hello Étienne,
Since we added the slippy map on MapOSMatic.org homepage, the load time
of the page has increased quite significantly since when loaded, it
automatically starts loading tiles from OSM servers. However, this is
useless since by default, the slippy map is not displayed.
Therefore, tonight, I've tried to keep the slippy map initialized,
until the user select the « Bounding Box » selection mode. This works
fine, except that the initial area displayed by the map is broken: for
some reason the lat/lon input boxes contain NaN (not a number) and the
slippy map shows a highly-zoomed area somewhere in the middle of France.
You'll find below the patch I've done to do this. Do you have any idea
of what's going wrong ?
Thanks a lot for your input!
Thomas
diff --git a/www/maposmatic/widgets.py b/www/maposmatic/widgets.py
index 0569c83..8e4742a 100644
--- a/www/maposmatic/widgets.py
+++ b/www/maposmatic/widgets.py
@@ -78,7 +78,7 @@ class AreaWidget(forms.TextInput):
</div>
""" % (upper_left_lat, upper_left_lon, lower_right_lon, lower_right_lat)
tpl += u"""<script type='text/javascript'><!--
-init();
+//init();
// -->
</script>
"""
diff --git a/www/templates/maposmatic/index.html
b/www/templates/maposmatic/index.html
index b93bb59..046e420 100644
--- a/www/templates/maposmatic/index.html
+++ b/www/templates/maposmatic/index.html
@@ -32,9 +32,15 @@
{% block extrajs %}
String.prototype.startsWith = function(str) { return this.indexOf(str) === 0; }
+bboxinitialized = false;
function area_selection_mode_switch(mode)
{
+ if (mode == 'bbox-mode' && bboxinitialized == false) {
+ bboxinitialized = true;
+ init();
+ }
+
var arr = document.getElementById('mapform').getElementsByTagName('tr');
for (i=0; i < arr.length; i++) {
if (arr[i].className.startsWith('byadmin')) {
--
Thomas Petazzoni http://thomas.enix.org
Promouvoir et défendre le Logiciel Libre http://www.april.org
Logiciels Libres à Toulouse http://www.toulibre.org
signature.asc
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Maposmatic-dev] Optimizing MapOSMatic homepage load time,
Thomas Petazzoni <=