Ignore:
Timestamp:
Jul 12, 2011, 9:27:44 AM (13 years ago)
Author:
rick
Message:

Make the balanced URLS points to the right location, making the new wlheatmap location (XXX:this should be dynamicly be done using a template!.

While we are here, apply DRY on URL generation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/wlheatmap/static/OpenStreetMap.js

    r9373 r9382  
    2929};
    3030
     31var wl_balancers = ['a','b','c','d','e','f'];
     32function get_balanced_urls(prefix, balancers, suffix) {
     33  var urls = [];
     34  for (i=0 ; i < balancers.length; i++) {
     35    urls.push(prefix + balancers[i] + suffix);
     36  };
     37  return urls;
     38};
     39
     40
    3141/**
    3242 * Class: OpenLayers.Layer.OSM.Mapnik
     
    4454     */
    4555    initialize: function(name, options) {
    46         var url = [
    47             "http://a.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
    48             "http://b.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
    49             "http://c.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
    50             "http://d.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
    51             "http://e.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
    52             "http://f.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
    53         ];
     56        var url = get_balanced_urls('http://', wl_balancers, '.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png');
    5457        options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
    5558        var newArguments = [name, url, options];
     
    165168OpenLayers.Layer.OSM.Overlay2 = OpenLayers.Class(OpenLayers.Layer.OSM, {
    166169    initialize: function(name, options) {
    167         var url = [
    168             "http://a.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
    169             "http://b.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
    170             "http://c.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
    171             "http://d.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
    172             "http://e.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
    173             "http://f.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
    174         ];
     170        var url = get_balanced_urls('http://', wl_balancers, '.maps.wirelessleiden.nl/wlheatmap/tile/${z}/${x},${y}.png?colour=90,90,90');
    175171        options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
    176172        var newArguments = [name, url, options];
     
    186182OpenLayers.Layer.OSM.Overlay3 = OpenLayers.Class(OpenLayers.Layer.OSM, {
    187183    initialize: function(name, options) {
    188         var url = [
    189             "http://a.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
    190             "http://b.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
    191             "http://c.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
    192             "http://d.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
    193             "http://e.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
    194             "http://f.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
    195         ];
     184        var url = get_balanced_urls('http://', wl_balancers, '.maps.wirelessleiden.nl/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden');
    196185        options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
    197186        var newArguments = [name, url, options];
     
    207196OpenLayers.Layer.OSM.Overlay4 = OpenLayers.Class(OpenLayers.Layer.OSM, {
    208197  initialize: function(name, options) {
    209     var url = [
    210       "http://a.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
    211       "http://b.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
    212       "http://c.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
    213       "http://d.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
    214       "http://e.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
    215       "http://f.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
    216     ];
     198    var url = get_balanced_urls('http://', wl_balancers, '.maps.wirelessleiden.nl/wlheatmap/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100');
    217199    options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
    218200    var newArguments = [name, url, options];
Note: See TracChangeset for help on using the changeset viewer.