Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a point on Google Map using python's gmaps? #336

Open
rahulbhadani opened this issue Apr 3, 2020 · 0 comments
Open

How to add a point on Google Map using python's gmaps? #336

rahulbhadani opened this issue Apr 3, 2020 · 0 comments

Comments

@rahulbhadani
Copy link

I am trying to add a Point on Google Map in Jupyter Notebook as follows:

import gmaps
API_Key = 'CJJUIIEaSyBpv6a' # This is not the legit key, I have not provided a real API key to avoid misuse and for security reasons
gmaps.configure(api_key=API_Key)
centroid_lat, centroid_long = (82.301581497344834, 110.89898182803991)
center_coordinates = (centroid_lat, centroid_long)
fig = gmaps.figure(center=center_coordinates, zoom_level=13.5)

P = gmaps.Point(center_coordinates)
point_layer = gmaps.drawing_layer(features=[P])
fig.add_layer(point_layer)
fig

However, I am getting following error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-35-baba23e890bf> in <module>
     10 #driving_layer = gmaps.heatmap_layer(coordinates)
     11 P = gmaps.Point(center_coordinates)
---> 12 point_layer = gmaps.drawing_layer(features=[P])
     13 fig.add_layer(driving_layer)
     14 fig
.
.
.

~/anaconda3/envs/dbn/lib/python3.7/site-packages/ipykernel/jsonutil.py in json_clean(obj)
    195 
    196     # we don't understand it, it's probably an unserializable object
--> 197     raise ValueError("Can't clean for JSON: %r" % obj)

ValueError: Can't clean for JSON: <gmaps.geotraitlets.Point object at 0x7fb6f1e3a490>

I don't understand error fully. Please help, if you have experience on using gmaps.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant