app/django/contrib/gis/maps/google/__init__.py
author Lennard de Rijk <ljvderijk@gmail.com>
Thu, 13 Aug 2009 14:02:22 -0700
changeset 2770 71a5a56cf29e
parent 323 ff1a9aa48cfd
permissions -rw-r--r--
Redone the acceptedStudentsExport functionality. The method has been renamed to exportStudentsWithProjects and retrieves the document_name and the new shipping address properties. Also it filters out all invalid projects or projects for wich the scope_path doesn't match the given scope_pa th_start. Also there is no more need to use the argument given to this method when adding the extra columns. The data is now prepared by one loop which uses the key present in the accepted_students dictionary for retrieving the data used by the extra columns.

"""
  This module houses the GoogleMap object, used for generating
   the needed javascript to embed Google Maps in a webpage.

  Google(R) is a registered trademark of Google, Inc. of Mountain View, California.

  Example:

   * In the view:
      return render_to_response('template.html', {'google' : GoogleMap(key="abcdefg")})

   * In the template:

     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     {{ google.xhtml }}
     <head>
       <title>Google Maps via GeoDjango</title>
       {{ google.style }}
       {{ google.scripts }}
     </head>
     {{ google.body }}
     <div id="{{ google.dom_id }}" style="width:600px;height:400px;"></div>
     </body>
     </html>

     Note:  If you want to be more explicit in your templates, the following are
      equivalent:
      {{ google.body }} => "<body {{ google.onload }} {{ google.onunload }}>"
      {{ google.xhtml }} => "<html xmlns="http://www.w3.org/1999/xhtml" {{ google.xmlns }}>"
      {{ google.style }} => "<style>{{ google.vml_css }}</style>"

  Explanation:
   - The `xhtml` property provides the correct XML namespace needed for 
     Google Maps to operate in IE using XHTML.  Google Maps on IE uses
     VML to draw polylines.  Returns, by default: 
     <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
       
   - The `style` property provides the correct style tag for the CSS
     properties required by Google Maps on IE:
     <style type="text/css">v\:* {behavior:url(#default#VML);}</style>

   - The `scripts` property provides the necessary <script> tags for 
     including the Google Maps javascript, as well as including the
     generated javascript.

   - The `body` property provides the correct attributes for the 
     body tag to load the generated javascript.  By default, returns:
     <body onload="gmap_load()" onunload="GUnload()">

   - The `dom_id` property returns the DOM id for the map.  Defaults to "map".

  The following attributes may be set or customized in your local settings:
   * GOOGLE_MAPS_API_KEY: String of your Google Maps API key.  These are tied to
      to a domain.  May be obtained from http://www.google.com/apis/maps/
   * GOOGLE_MAPS_API_VERSION (optional): Defaults to using "2.x"
   * GOOGLE_MAPS_URL (optional): Must have a substitution ('%s') for the API
      version.
"""
from django.contrib.gis.maps.google.gmap import GoogleMap
from django.contrib.gis.maps.google.overlays import GEvent, GMarker, GPolygon, GPolyline
from django.contrib.gis.maps.google.zoom import GoogleZoom