Skip to content

Commit 04ac9cd

Browse files
authored
Merge branch 'master' into typing_support
2 parents a8f3695 + 7253932 commit 04ac9cd

File tree

13 files changed

+1255
-507
lines changed

13 files changed

+1255
-507
lines changed

Changlog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ Changelog
22
=========
33

44

5+
0.4.1 (2020-02-21)
6+
------------
7+
- Added support for marker labels [jackcarter]
8+
- Added KML layer: User can add hyperlink of KML file to apply on the map [bhuveshsharma09]
9+
- Added Bicycle lane layer: User can turn on/off bicycle lane using the new attribute [bhuveshsharma09]
10+
- Added Custom Styles: User can add custom style JSON file for the map style [bhuveshsharma09]
11+
- Validated the lat lng coordinates when initialize the Map object [JacobGeoGeek]
12+
- Added map id support [markmelnic]
13+
- Updated some dependencies [Vicente Marçal]
14+
15+
516
0.4.0 (2020-02-21)
617
------------
718
- Added Trafficlayer support [wimpruijsers]

README.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ if __name__ == "__main__":
126126
##### `Map()` Parameters
127127

128128
- **lat**: The latitude coordinate for centering the map.
129-
- **lng**: The longitutde coordinate for centering the map.
129+
- **lng**: The longitude coordinate for centering the map.
130130
- **zoom**: The zoom level. Defaults to `13`.
131131
- **maptype**: The map type - `ROADMAP`, `SATELLITE`, `HYBRID`, `TERRAIN`. Defaults to `ROADMAP`.
132-
- **markers**: Markers array of tuples having (**lat**, **lng**, infobox, icon). Defaults to `None`.
133-
- or **markers**: a list of dicts containing **icon, lat, lng, infobox**.
132+
- **markers**: Markers array of tuples having (**lat**, **lng**, infobox, icon, label). Defaults to `None`.
133+
- or **markers**: a list of dicts containing **lat**, **lng**, infobox, icon, label.
134134
- or **markers**: Markers dictionary with icon urls as keys and markers array as values.
135135
- **varname**: The instance variable name.
136136
- **style**: A string containing CSS styles. Defaults to `"height:300px;width:300px;margin:0;"`.
@@ -223,6 +223,40 @@ Here's an example snippet of code:
223223
Which results in something like the following map:
224224
<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">
225225

226+
### Label
227+
228+
Here's an example snippet of code:
229+
```python
230+
231+
Map(
232+
identifier="labelsmap",
233+
lat=37.4419,
234+
lng=-122.1419,
235+
markers=[
236+
{
237+
'lat': 37.4500,
238+
'lng': -122.1350,
239+
'label': "X"
240+
},
241+
{
242+
'lat': 37.4419,
243+
'lng': -122.1419,
244+
'label': "Y"
245+
},
246+
{
247+
'lat': 37.4300,
248+
'lng': -122.1400,
249+
'label': "Z"
250+
}
251+
]
252+
)
253+
254+
```
255+
256+
Which results in something like the following map:
257+
258+
<img width="271" alt="Map showing markers with labels" src="https://user-images.githubusercontent.com/708882/92332217-a3363280-f041-11ea-975c-0ac9413ada68.png">
259+
226260
### Fit all markers within bounds
227261

228262
Allow users to easily fit all markers within view on page load

examples/dark_mode.json

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
[
2+
{
3+
"elementType": "geometry",
4+
"stylers": [
5+
{
6+
"color": "#242f3e"
7+
}
8+
]
9+
},
10+
{
11+
"elementType": "labels.text.fill",
12+
"stylers": [
13+
{
14+
"color": "#746855"
15+
}
16+
]
17+
},
18+
{
19+
"elementType": "labels.text.stroke",
20+
"stylers": [
21+
{
22+
"color": "#242f3e"
23+
}
24+
]
25+
},
26+
{
27+
"featureType": "administrative.locality",
28+
"elementType": "labels.text.fill",
29+
"stylers": [
30+
{
31+
"color": "#d59563"
32+
}
33+
]
34+
},
35+
{
36+
"featureType": "poi",
37+
"elementType": "labels.text.fill",
38+
"stylers": [
39+
{
40+
"color": "#d59563"
41+
}
42+
]
43+
},
44+
{
45+
"featureType": "poi.park",
46+
"elementType": "geometry",
47+
"stylers": [
48+
{
49+
"color": "#263c3f"
50+
}
51+
]
52+
},
53+
{
54+
"featureType": "poi.park",
55+
"elementType": "labels.text.fill",
56+
"stylers": [
57+
{
58+
"color": "#6b9a76"
59+
}
60+
]
61+
},
62+
{
63+
"featureType": "road",
64+
"elementType": "geometry",
65+
"stylers": [
66+
{
67+
"color": "#38414e"
68+
}
69+
]
70+
},
71+
{
72+
"featureType": "road",
73+
"elementType": "geometry.stroke",
74+
"stylers": [
75+
{
76+
"color": "#212a37"
77+
}
78+
]
79+
},
80+
{
81+
"featureType": "road",
82+
"elementType": "labels.text.fill",
83+
"stylers": [
84+
{
85+
"color": "#9ca5b3"
86+
}
87+
]
88+
},
89+
{
90+
"featureType": "road.highway",
91+
"elementType": "geometry",
92+
"stylers": [
93+
{
94+
"color": "#746855"
95+
}
96+
]
97+
},
98+
{
99+
"featureType": "road.highway",
100+
"elementType": "geometry.stroke",
101+
"stylers": [
102+
{
103+
"color": "#1f2835"
104+
}
105+
]
106+
},
107+
{
108+
"featureType": "road.highway",
109+
"elementType": "labels.text.fill",
110+
"stylers": [
111+
{
112+
"color": "#f3d19c"
113+
}
114+
]
115+
},
116+
{
117+
"featureType": "transit",
118+
"elementType": "geometry",
119+
"stylers": [
120+
{
121+
"color": "#2f3948"
122+
}
123+
]
124+
},
125+
{
126+
"featureType": "transit.station",
127+
"elementType": "labels.text.fill",
128+
"stylers": [
129+
{
130+
"color": "#d59563"
131+
}
132+
]
133+
},
134+
{
135+
"featureType": "water",
136+
"elementType": "geometry",
137+
"stylers": [
138+
{
139+
"color": "#17263c"
140+
}
141+
]
142+
},
143+
{
144+
"featureType": "water",
145+
"elementType": "labels.text.fill",
146+
"stylers": [
147+
{
148+
"color": "#515c6d"
149+
}
150+
]
151+
},
152+
{
153+
"featureType": "water",
154+
"elementType": "labels.text.stroke",
155+
"stylers": [
156+
{
157+
"color": "#17263c"
158+
}
159+
]
160+
}
161+
]

examples/example_2.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
from flask import Flask, render_template
2+
from flask_googlemaps import GoogleMaps, Map, icons
3+
from dynaconf import FlaskDynaconf
4+
#enter the api key below
5+
api = ''
6+
app = Flask(__name__)
7+
GoogleMaps(app, key = api)
8+
FlaskDynaconf(app)
9+
10+
import json
11+
12+
13+
@app.route("/")
14+
def map_created_in_view():
15+
16+
with open('dark_mode.json') as d:
17+
dark_data = json.load(d)
18+
19+
wmap = Map(
20+
identifier="wmap",
21+
varname="wmap",
22+
lat=41.881832,
23+
lng=-87.623177,
24+
markers={
25+
icons.dots.green: [(37.4419, -122.1419), (37.4500, -122.1350)],
26+
icons.dots.blue: [(37.4300, -122.1400, "Hello World")],
27+
},
28+
style="height:400px;width:600px;margin:0;color:#242f3e;",
29+
bicycle_layer = True,
30+
)
31+
32+
33+
gmap = Map(
34+
identifier="gmap",
35+
varname="gmap",
36+
lat=1.351616,
37+
lng=103.808053,
38+
markers={
39+
icons.alpha.A: [(1.351616, 103.808053), (37.4500, -122.1350)],
40+
icons.dots.blue: [(37.4300, -122.1400, "Hello World")],
41+
},
42+
style="height:400px;width:600px;margin:0;color:#242f3e;",
43+
layer = "https://geo.data.gov.sg/dengue-cluster/2020/09/02/kml/dengue-cluster.kml"
44+
)
45+
46+
dmap = Map(
47+
identifier="dmap",
48+
varname="dmap",
49+
lat=1.351616,
50+
lng=103.808053,
51+
markers={
52+
icons.dots.green: [(37.4419, -122.1419), (37.4500, -122.1350)],
53+
icons.dots.blue: [(37.4300, -122.1400, "Hello World")],
54+
},
55+
style="height:400px;width:600px;margin:0;color:#242f3e;",
56+
styles=dark_data,
57+
58+
)
59+
60+
# print(get_address(api, 22.4761596, 88.4149326))
61+
return render_template("example_2.html", dmap=dmap ,gmap = gmap, wmap = wmap,key = api)
62+
63+
64+
65+
66+
67+
if __name__ == "__main__":
68+
app.run(port=5050, debug=True)

examples/templates/example_2.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
8+
{{ dmap.js }}
9+
{{ wmap.js }}
10+
{{ gmap.js }}
11+
</head>
12+
<body>
13+
14+
<h2>Custom Style</h2>
15+
{{ dmap.html }}
16+
17+
<h2>Bicycle lane</h2>
18+
{{ wmap.html }}
19+
20+
<h2>KML layer</h2>
21+
{{ gmap.html }}
22+
23+
</body>
24+
</html>

0 commit comments

Comments
 (0)