forked from flask-extensions/Flask-GoogleMaps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
87 lines (74 loc) · 2.04 KB
/
Copy pathexample.html
File metadata and controls
87 lines (74 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Flask Google Maps Example</title>
<link rel="stylesheet" href="">
{{"decoupled-map"|googlemap_js(37.4419, -122.1419, markers=[(37.4419, -122.1419)])}}
{{mymap.js}}
</head>
<body>
<h1>Flask Google Maps Example</h1>
<h2> Template function centered, no marker </h2>
{{googlemap("simple-map", 37.4419, -122.1419)}}
<code>
<pre>
{% raw %}
{{googlemap("simple-map", 37.4419, -122.1419)}}
{% endraw %}
</pre>
</code>
<h2> Template filter decoupled with single marker </h2>
{{"decoupled-map"|googlemap_html(37.4419, -122.1419)}}
<code>
<pre>
{% raw %}
on the head:
{{"decoupled-map"|googlemap_js(37.4419, -122.1419, markers=[(37.4419, -122.1419)])}}
on the body:
{{"decoupled-map"|googlemap_html(37.4419, -122.1419)}}
{% endraw %}
</pre>
</code>
<h2> Template function with multiple markers </h2>
{% with map=googlemap_obj("another-map", 37.4419, -122.1419, markers=[(37.4419, -122.1419), (37.4300, -122.1400)]) %}
{{map.html}}
{{map.js}}
{% endwith %}
<code>
<pre>
{% raw %}
{% with map=googlemap_obj("another-map", 37.4419, -122.1419, markers=[(37.4419, -122.1419), (37.4300, -122.1400)]) %}
{{map.html}}
{{map.js}}
{% endwith %}
{% endraw %}
</pre>
</code>
<h2> Generated in view</h2>
{{mymap.html}}
<code>
<pre>
{% raw %}
View:
from flaskext.googlemaps import Map
@app.route("/")
def mapview():
mymap = Map(
identifier="view-side",
lat=37.4419,
lng=-122.1419,
markers=[(37.4419, -122.1419)]
)
return render_template('example.html', mymap=mymap)
Template:
in head:
{{mymap.js}}
in body:
{{mymap.html}}
{% endraw %}
</pre>
</code>
</body>
</html>