Skip to content

Commit

Permalink
mobile template (testing iPhone performance)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtigas committed Aug 8, 2010
1 parent bfc3d2c commit 99d88dc
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/gheat_demo/templates/home-mobile.html
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>"Tweetmap," a heatmap of tweet locations</title>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<script type="text/javascript">
var heatmap = new google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
var tileRange = 1 << zoom;

var y = coord.y;
if (y < 0 || y >= tileRange) {
return null;
}
var x = coord.x;
if (x < 0 || x >= tileRange) {
x = (x % tileRange + tileRange) % tileRange;
}

return "/tweetmap/tiles/firetrans/" + zoom + "/" + x + "," + y + ".png";
},
tileSize: new google.maps.Size(256, 256),
isPng: true
});

var map;
function initialize() {
map = new google.maps.Map(document.getElementById("map"));
map.setCenter(new google.maps.LatLng(38.9517053, -92.3340724));
map.setZoom(4);
map.setMapTypeId('terrain');
map.overlayMapTypes.insertAt(0, heatmap);
}
</script>
<style type="text/css">
html, body, #map {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body onload="initialize()">
<div id="map">&nbsp;</div>
</body>
</html>
11 changes: 11 additions & 0 deletions src/gheat_demo/tweetmap/urls.py
Expand Up @@ -16,6 +16,17 @@
}
}
),
url(
regex = r'^m/$',
view = direct_to_template,
name = 'home_mobile',
kwargs = {
'template': getattr(settings,"TWEETMAP_DEFAULT_TEMPLATE","home-mobile.html"),
'extra_context': {
'tweet_count':TweetPoint.objects.count()
}
}
),
# URL pattern that serves tiles at the path that Google Maps API expects
# ex.: /tweetmap/tiles/fire/12/3,2.png
url(
Expand Down

0 comments on commit 99d88dc

Please sign in to comment.