Skip to main content

Small extension for Flask to make using Google Maps easy

Project description

# Flask Google Maps

Easy to use Google Maps in your Flask application

### requires
- Jinja
- Flask
- A google api key (optional I guess)

### Installation

```pip install flask-googlemaps```


git clone
cd Flask-GoogleMaps
python install

### Usage

You can create the map in the view and then send to the template context or you can use the template functions and filters directly

#### View

from flask import Flask, render_template
from flaskext.googlemaps import GoogleMaps
from flaskext.googlemaps import Map

app = Flask(__name__, template_folder=".")

def mapview():
# creating a map in the view
mymap = Map(
markers=[(37.4419, -122.1419)]
return render_template('example.html', mymap=mymap)

if __name__ == "__main__":

#### Template

<!DOCTYPE html>
{{"decoupled-map"|googlemap_js(37.4419, -122.1419, markers=[(37.4419, -122.1419)])}}
<h1>Flask Google Maps Example</h1>

<h2> Template function centered, no marker </h2>
{{googlemap("simple-map", 37.4419, -122.1419)}}

<h2> Template filter decoupled with single marker </h2>
{{"decoupled-map"|googlemap_html(37.4419, -122.1419)}}

<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)]) %}
{% endwith %}

<h2> Generated in view</h2>


### Screenshot

<img src="screenshot.png" />

### TODO:

Implement other methods from the api, add layers etc...

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for flask-googlemaps, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size Flask-GoogleMaps-0.1.4.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page