Skip to content

Commit 9677f7f

Browse files
authored
Merge pull request #149 from gferioli0418/master
Create a marker click listener for the map
2 parents 43ab75c + 14a4eba commit 9677f7f

File tree

2 files changed

+261
-279
lines changed

2 files changed

+261
-279
lines changed

flask_googlemaps/__init__.py

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -47,42 +47,13 @@ def __init__(
4747
cluster_gridsize=60, # type: int
4848
fit_markers_to_bounds=False, # type: bool
4949
center_on_user_location=False, # type: bool
50+
report_markerClickpos=False, # type: bool
5051
report_clickpos=False, # type: bool
52+
markerClickpos_uri="", # type: str
5153
clickpos_uri="", # type: str
52-
identifier,
53-
lat,
54-
lng,
55-
zoom=13,
56-
maptype="ROADMAP",
57-
markers=None,
58-
map_ids=None,
59-
varname="map",
60-
style="height:300px;width:300px;margin:0;",
61-
cls="map",
62-
language="en",
63-
region="US",
64-
rectangles=None,
65-
circles=None,
66-
polylines=None,
67-
polygons=None,
68-
zoom_control=True,
69-
maptype_control=True,
70-
scale_control=True,
71-
streetview_control=True,
72-
rotate_control=True,
73-
scroll_wheel=True,
74-
fullscreen_control=True,
75-
collapsible=False,
76-
mapdisplay=False,
77-
cluster=False,
78-
cluster_imagepath=DEFAULT_CLUSTER_IMAGE_PATH,
79-
cluster_gridsize=60,
80-
fit_markers_to_bounds=False,
81-
center_on_user_location=False,
82-
report_clickpos=False,
83-
clickpos_uri="",
8454
styles="",
8555
layer="",
56+
map_ids=None,
8657
bicycle_layer=False,
8758
**kwargs
8859
):
@@ -120,6 +91,8 @@ def __init__(
12091
self.center_on_user_location = center_on_user_location
12192
self.report_clickpos = report_clickpos
12293
self.clickpos_uri = clickpos_uri
94+
self.report_markerClickpos = report_markerClickpos
95+
self.markerClickpos_uri = markerClickpos_uri
12396

12497
self.cluster = cluster
12598
self.cluster_imagepath = cluster_imagepath
@@ -130,7 +103,6 @@ def __init__(
130103
self.layer = layer
131104
self.bicycle_layer = bicycle_layer
132105

133-
134106
def build_markers(self, markers):
135107
# type: (Optional[Union[Dict, List, Tuple]]) -> None
136108
if not markers:
@@ -800,11 +772,13 @@ def as_json(self):
800772

801773
def verify_lat_lng_coordinates(self, lat, lng):
802774
if not (90 >= lat >= -90):
803-
raise AttributeError("Latitude must be between -90 and 90 degrees inclusive.")
775+
raise AttributeError(
776+
"Latitude must be between -90 and 90 degrees inclusive.")
804777
if not (180 >= lng >= -180):
805-
raise AttributeError("Longitude must be between -180 and 180 degrees inclusive.")
806-
807-
return (lat,lng)
778+
raise AttributeError(
779+
"Longitude must be between -180 and 180 degrees inclusive.")
780+
781+
return (lat, lng)
808782

809783
@property
810784
def js(self):
@@ -869,7 +843,6 @@ def get_address(API_KEY, lat, lon):
869843
def get_coordinates(API_KEY, address_text):
870844
# type: (str, str) -> Dict
871845
response = requests.get(
872-
response = rq.get(
873846
"https://maps.googleapis.com/maps/api/geocode/json?address="
874847
+ address_text
875848
+ "&key="

0 commit comments

Comments
 (0)