Changeset 9113


Ignore:
Timestamp:
Apr 26, 2011, 3:00:57 PM (14 years ago)
Author:
dennisw
Message:

Supports OpenLayers/OpenStreetMap instead of Google Maps.

Location:
src/django_gheat/samples/persisted
Files:
18 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/samples/persisted/settings.py

    r9051 r9113  
    5555ADMIN_MEDIA_PREFIX = '/media/'
    5656
     57# Absolute path to the directory static files should be collected to.
     58# Don't put anything in this directory yourself; store your static files
     59# in apps' "static/" subdirectories and in STATICFILES_DIRS.
     60# Example: "/home/media/media.lawrence.com/static/"
     61STATIC_ROOT = ''
     62
     63# URL prefix for static files.
     64# Example: "http://media.lawrence.com/static/"
     65STATIC_URL = '/static/'
     66
     67# URL prefix for admin static files -- CSS, JavaScript and images.
     68# Make sure to use a trailing slash.
     69# Examples: "http://foo.com/static/admin/", "/static/admin/".
     70ADMIN_MEDIA_PREFIX = '/static/admin/'
     71
     72# Additional locations of static files
     73STATICFILES_DIRS = (
     74    '/home/dennis/Desktop/django_gheat/samples/persisted/static',
     75    # Put strings here, like "/home/html/static" or "C:/www/django/static".
     76    # Always use forward slashes, even on Windows.
     77    # Don't forget to use absolute paths, not relative paths.
     78)
     79
     80# List of finder classes that know how to find static files in
     81# various locations.
     82STATICFILES_FINDERS = (
     83    'django.contrib.staticfiles.finders.FileSystemFinder',
     84    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
     85#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
     86)
     87
     88
     89
    5790# Make this unique, and don't share it with anybody.
    5891SECRET_KEY = '=wg@x19kr@26sibiaynb9ax5ddp1&yu^+$3n++^_lz1ms80syb'
     
    89122    'gheat',
    90123    'home',
     124    'django.contrib.staticfiles',
    91125)
    92126
     
    94128#GOOGLE_MAPS_KEY = 'ABQIAAAAnfs7bKE82qgb3Zc2YyS-oBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSySz_REpPq-4WZA27OwgbtyR3VcA' # external ip
    95129GOOGLE_MAPS_KEY = 'ABQIAAAA6NuvWGazX80RVrkSkvrUXBTpH3CbXHjuCVmaTc5MkkU4wO1RRhSZXiYEMqjgwJ9gi_PC8AA-dDGz6g' # 127.0.0.1:8000
    96 
    97 
    98 
  • src/django_gheat/samples/persisted/templates/home.html

    r9060 r9113  
    11<html>
    22<head>
    3 
    4     <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={{ google_key }}"></script>
    5     <script>
    6 
    7         bounds = new GLatLngBounds( new GLatLng(-90, -180)
    8                                   , new GLatLng(90, 180)
    9                                    );
    10         copyright = new GCopyright( 'your-copyright'
    11                                   , bounds
    12                                   , 0
    13                                   , "(c) 2008 Your Organization " +
    14                                     "<http://www.example.org/>"
    15                                    );
    16         copyrights = new GCopyrightCollection();
    17         copyrights.addCopyright(copyright);
    18         heatmap = new GTileLayer(copyrights, 10, 0);
    19         heatmap.getTileUrl = function (tile, zoom) {
    20             base = 'http://127.0.0.1:8000/gheat/';
    21             color_scheme = 'classic';
    22             url = base + color_scheme +'/'+ zoom +'/'
    23             url += tile.x +','+ tile.y +'.png';
    24             return url;
    25         }
    26         heatmap.isPng = function () {return true;}
    27         heatmap.getOpacity = function () {return 1.0;}
    28    
    29         function initialize () {
    30             var map = new GMap2(document.getElementById("map"));
    31             var lebanon = new GLatLng(52.15,4.47);
    32             map.setCenter(lebanon, 13);
    33             map.setUIToDefault();
    34             map.addOverlay(new GTileLayerOverlay(heatmap));
    35         }
    36    
    37     </script>
     3  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}OpenLayers.js"></script>
     4  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap.js"></script>
     5  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}OpenStreetMap.js"></script>
    386    <style>
    39         body {
    40             margin: 0;
    41             padding: 0;
    42         }
    43         #map {
    44             margin: 0;
    45             padding: 0;
    46             width: 100%;
    47             height: 100%;
    48         }
     7      #heatmap{
     8        width:100%;
     9        height:100%;
     10      }
    4911    </style>
    5012</head>
    51 <body onload="initialize()" onunload="GUnload()">
    52     <div id="map">&nbsp;</div>       
     13<body onload="init()">
     14  <div id="heatmap"></div>
    5315</body>
    5416</html>
  • src/django_gheat/samples/persisted/urls.py

    r9041 r9113  
    11from django.conf.urls.defaults import *
     2from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    23
    34# Uncomment the next two lines to enable the admin:
     
    1112    (r'^admin/', include(admin.site.urls)),
    1213)
     14urlpatterns += staticfiles_urlpatterns()
     15
Note: See TracChangeset for help on using the changeset viewer.