Created
July 27, 2016 17:06
-
-
Save RuanAragao/3a07edebd5beef7fd193d07f803c5695 to your computer and use it in GitHub Desktop.
Flask Google Maps example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ | |
googlemap( | |
identifier="no-controls-map", | |
lat=37.4419, | |
lng=-122.1419, | |
zoom_control=False, | |
maptype_control=False, | |
scale_control=False, | |
streetview_control=False, | |
rotate_control=False, | |
fullscreen_control=False | |
) | |
}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% with map=googlemap_obj("another-map", 37.4419, -122.1419, markers=[(37.4419, -122.1419), (37.4300, -122.1400, "Hello")]) %} | |
{{map.html}} | |
{{map.js}} | |
{% endwith %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
View: | |
from flask_googlemaps import Map | |
@app.route("/") | |
def mapview(): | |
mymap = Map( | |
identifier="cluster-map", | |
lat=37.4419, | |
lng=-122.1419, | |
markers=[{'lat': 37.4419, 'lng': -122.1419}, {'lat': 37.4500, 'lng': -122.1419}, {'lat': 36.4419, 'lng': -120.1419}] | |
cluster=True, | |
cluster_gridsize=10 | |
) | |
return render_template('clustermap.html', clustermap=clustermap) | |
Template: | |
in head: | |
{{clustermap.js}} | |
in body: | |
{{clustermap.html}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{googlemap("simple-map", 37.4419, -122.1419)}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment