@@ -7,35 +7,38 @@ Easy to use Google Maps in your Flask application
77
88Look the Live DEMO: http://flaskgooglemaps.pythonanywhere.com 
99
10- ### requires  
10+ ## requires  
11+ 
1112-  Jinja
1213-  Flask
1314-  A google api key [ get here] ( https://developers.google.com/maps/documentation/javascript/get-api-key ) 
1415
1516
16- ###  Installation  
17+ ## Installation  
1718
1819``` pip install flask-googlemaps ``` 
1920
2021or
2122
2223``` bash 
24+ 
2325git clone https://github.com/rochacbruno/Flask-GoogleMaps
2426cd  Flask-GoogleMaps
2527python setup.py install
26- ``` 
2728
29+ ``` 
2830
29- ###  How it works  
31+ ## How it works  
3032
3133Flask-GoogleMaps includes some global functions and template filters in your Jinja environment, also it allows you to use the Map in views if needed.
3234
3335
34- ####  registering  
36+ ### registering  
3537
3638in your app
3739
3840``` python 
41+ 
3942from  flask import  Flask
4043from  flask_googlemaps import  GoogleMaps
4144
@@ -55,7 +58,9 @@ GoogleMaps(app, key="8JZ7i18MjFuM35dJHq70n3Hx4")
5558In template
5659
5760``` html 
61+ 
5862{{googlemap("my_awesome_map", lat=0.23234234, lng=-0.234234234, markers=[(0.12, -0.45345), ...])}}
63+ 
5964``` 
6065
6166That's it! now you have some template filters and functions to use, more details in examples and screenshot below.
@@ -71,6 +76,7 @@ That's it! now you have some template filters and functions to use, more details
7176#### 1. View  
7277
7378``` python 
79+ 
7480from  flask import  Flask, render_template
7581from  flask_googlemaps import  GoogleMaps
7682from  flask_googlemaps import  Map
@@ -110,9 +116,10 @@ def mapview():
110116
111117if  __name__  ==  " __main__" 
112118    app.run(debug = True )
119+ 
113120``` 
114121
115- ##### ` Map() `  Parameters:  
122+ ##### ` Map() `  Parameters 
116123
117124-  ** lat** : The latitude coordinate for centering the map.
118125-  ** lng** : The longitutde coordinate for centering the map.
@@ -143,6 +150,7 @@ Also controls True or False:
143150#### 2. Template  
144151
145152``` html 
153+ 
146154<!DOCTYPE html>
147155    <html >
148156    <head >
@@ -159,7 +167,6 @@ Also controls True or False:
159167        <h2 > Template filter decoupled with single marker </h2 >
160168        {{"decoupled-map"|googlemap_html(37.4419, -122.1419)}}
161169
162- 
163170        <h2 > Template function with multiple markers </h2 >
164171        {% with map=googlemap_obj("another-map", 37.4419, -122.1419, markers=[(37.4419, -122.1419), (37.4300, -122.1400)]) %}
165172            {{map.html}}
@@ -180,8 +187,9 @@ Also controls True or False:
180187
181188### Infobox  
182189
183- Here's an example snippet of code:  
190+ Here's an example snippet of code:
184191``` python 
192+ 
185193    Map(
186194        identifier = " catsmap" 
187195        lat = 37.4419 ,
@@ -213,11 +221,15 @@ Here's an example snippet of code:
213221Which results in something like the following map:
214222<img  width =" 1439 "  alt =" screen shot 2015-07-29 at 2 41 52 pm "  src =" https://cloud.githubusercontent.com/assets/8108300/8969650/13b0de7a-3602-11e5-9ed0-9f328ac9253f.png " >
215223
224+ 
216225### Fit all markers within bounds  
226+ 
217227Allow users to easily fit all markers within view on page load
218228
219229#### Without bounds  
230+ 
220231``` python 
232+ 
221233@app.route (' /map-unbounded/' 
222234def  map_unbounded ():
223235""" Create map with markers out of bounds.""" 
@@ -228,11 +240,15 @@ def map_unbounded():
228240        markers = [(loc.latitude, loc.longitude) for  loc in  locations]
229241    )
230242    return  render_template(' map.html' map = map )
243+ 
231244``` 
245+ 
232246![ image] ( https://user-images.githubusercontent.com/14223309/29294427-24a8d4e0-8104-11e7-967b-0c55c20d0f7c.png ) 
233247
234248#### With bounds  
249+ 
235250``` python 
251+ 
236252@app.route (' /map-bounded/' 
237253def  map_bounded ():
238254""" Create map with all markers within bounds.""" 
@@ -244,22 +260,26 @@ def map_bounded():
244260        fit_markers_to_bounds  =  True 
245261    )
246262    return  render_template(' map.html' map = map )
263+ 
247264``` 
265+ 
248266![ image] ( https://user-images.githubusercontent.com/14223309/29294483-6ac3e532-8104-11e7-988c-5c19d700fe5b.png ) 
249267
250268### Run the example app  
251269
252270``` bash 
271+ 
253272$ git clone https://github.com/rochacbruno/Flask-GoogleMaps
254273$ cd  Flask-GoogleMaps/examples
255274$ python setup.py develop
256275$ python example.py
276+ running..
257277
258278``` 
259279
260280Access: http://localhost:5000/  and http://localhost:5000/fullmap 
261281
262- ### TODO (open a Pull Request):   
282+ ### TODO (open a Pull Request)  
263283
264284Implement other methods from the api, add layers etc...
265285
0 commit comments