App Engine Python SDK version 1.7.4 (2)
[gae.git] / python / lib / django_1_4 / django / contrib / gis / maps / google / __init__.py
blob9be689c07abfb9f6f228ad008eef8c30eeddd447
1 """
2 This module houses the GoogleMap object, used for generating
3 the needed javascript to embed Google Maps in a Web page.
5 Google(R) is a registered trademark of Google, Inc. of Mountain View, California.
7 Example:
9 * In the view:
10 return render_to_response('template.html', {'google' : GoogleMap(key="abcdefg")})
12 * In the template:
14 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
15 {{ google.xhtml }}
16 <head>
17 <title>Google Maps via GeoDjango</title>
18 {{ google.style }}
19 {{ google.scripts }}
20 </head>
21 {{ google.body }}
22 <div id="{{ google.dom_id }}" style="width:600px;height:400px;"></div>
23 </body>
24 </html>
26 Note: If you want to be more explicit in your templates, the following are
27 equivalent:
28 {{ google.body }} => "<body {{ google.onload }} {{ google.onunload }}>"
29 {{ google.xhtml }} => "<html xmlns="http://www.w3.org/1999/xhtml" {{ google.xmlns }}>"
30 {{ google.style }} => "<style>{{ google.vml_css }}</style>"
32 Explanation:
33 - The `xhtml` property provides the correct XML namespace needed for
34 Google Maps to operate in IE using XHTML. Google Maps on IE uses
35 VML to draw polylines. Returns, by default:
36 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
38 - The `style` property provides the correct style tag for the CSS
39 properties required by Google Maps on IE:
40 <style type="text/css">v\:* {behavior:url(#default#VML);}</style>
42 - The `scripts` property provides the necessary <script> tags for
43 including the Google Maps javascript, as well as including the
44 generated javascript.
46 - The `body` property provides the correct attributes for the
47 body tag to load the generated javascript. By default, returns:
48 <body onload="gmap_load()" onunload="GUnload()">
50 - The `dom_id` property returns the DOM id for the map. Defaults to "map".
52 The following attributes may be set or customized in your local settings:
53 * GOOGLE_MAPS_API_KEY: String of your Google Maps API key. These are tied to
54 to a domain. May be obtained from http://www.google.com/apis/maps/
55 * GOOGLE_MAPS_API_VERSION (optional): Defaults to using "2.x"
56 * GOOGLE_MAPS_URL (optional): Must have a substitution ('%s') for the API
57 version.
58 """
59 from django.contrib.gis.maps.google.gmap import GoogleMap, GoogleMapSet
60 from django.contrib.gis.maps.google.overlays import GEvent, GIcon, GMarker, GPolygon, GPolyline
61 from django.contrib.gis.maps.google.zoom import GoogleZoom