Closed nlehuby closed 6 years ago
@nlehuby great call - right now we wrap the python variable passed to style_url as a string in each jinja template. We should enable an option to pass a python dictionary in JSON format and have the Jinja template format it as a JS object, not a string.
Change the parameter name for viz
class to style
from style_url
, and in the viz.py
class, check if the style
parameter is a url
string or a Mapbox GL format JSON object.
Sample Python syntax for a mapboxgl.viz class:
# Stylesheet as Python dictionary in JSON format
mystyle = {my_mapbox_stylesheet}
#Load as a local stylesheet
viz3 = CircleViz(data, access_token=token, color_property='Avg Covered Charges',
style=mystyle,
color_stops=color_stops, center=[-95, 40], zoom=3)
#Load as a Mapbox Style
viz3 = CircleViz(data, access_token=token, color_property='Avg Covered Charges',
style="mapbox://ryanbaumann/styles/mystyle",
color_stops=color_stops, center=[-95, 40], zoom=3)
thanks for your reply !
Your proposal is very close to the javascript mapboxgl API, so it would very easy to use. I do approve :+1:
@nlehuby is this an issue you could submit a PR for?
This shipped in #59 !
Stumbled upon this issue while looking for a fix for: https://stackoverflow.com/questions/62751062/mapbox-gl-in-jupyter-notebook-add-custom-marker/.
I'd like to use a custom marker for point coordinates, however, not seeing where do I make the fix.
Hey there @kevalshah90 , I had started something along those lines with https://github.com/mapbox/mapboxgl-jupyter/pull/149. Does something along those lines meet your need? Or are you looking for something that just substitutes a different shape in place of a circle marker? That's not (yet) supported, but definitely something we could look into! Feel free to open a new issue :) https://github.com/mapbox/mapboxgl-jupyter/issues/
Hi @akacarlyann. Thanks. Yes, I think something along those lines would work. I was looking to replace the circle marker with a different icon from maki library, if available, if not, replace it with a different custom icon/image.
Side question, how do I change the size of the circle marker? Thx.
On Tue, Jul 7, 2020, 06:51 akacarlyann notifications@github.com wrote:
Hey there @kevalshah90 https://github.com/kevalshah90 , I had started something along those lines with #149 https://github.com/mapbox/mapboxgl-jupyter/pull/149. Does something along those lines meet your need? Or are you looking for something that just substitutes a different shape in place of a circle marker? That's not (yet) supported, but definitely something we could look into!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mapbox/mapboxgl-jupyter/issues/19#issuecomment-654543684, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABESAIIYLBE7NQNDK6VDGFDR2J2A7ANCNFSM4EEQ6GEQ .
@kevalshah90 ah yes, the maki icons was the direction we decided to go, instead of that old PR I linked. I haven't gotten around to it yet, but glad to hear there's another vote for that feature.
For changing the marker radius, if you are using the CircleViz
type, (https://mapbox-mapboxgl-jupyter.readthedocs-hosted.com/en/latest/viz.html#class-circleviz) then you can set the radius as an argument. Here's an example:
viz = CircleViz(data,
radius=5,
access_token=token)
viz.show()
Hope that helps!
Excellent. That worked! Thanks, I might have missed it in the documentation.
Yes, I look forward to when you push those changes. It's a feature I am quite keen on. Does this apply for jupyter-notebook/mapbox-gl only?
On Tue, Jul 7, 2020 at 10:18 PM akacarlyann notifications@github.com wrote:
@kevalshah90 https://github.com/kevalshah90 ah yes, the maki icons was the direction we decided to go, instead of that old PR I linked. I haven't gotten around to it yet, but glad to hear there's another vote for that feature.
For changing the marker radius, if you are using the CircleViz type, ( https://mapbox-mapboxgl-jupyter.readthedocs-hosted.com/en/latest/viz.html#class-circleviz) then you can set the radius as an argument. Here's an example:
viz = CircleViz(data, radius=5, access_token=token)viz.show()
Hope that helps!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mapbox/mapboxgl-jupyter/issues/19#issuecomment-654989497, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABESAIPQ6UPJNOCFEKNBWNTR2NGVZANCNFSM4EEQ6GEQ .
Glad to hear it! I think the answer to your question is yes. This repository just implements Python bindings to create visualizations embedded in a Jupyter notebook using Mapbox's JavaScript library. We are currently loading the Mapbox GL JS version 1.5.0 in our HTML template.
Thanks for reaching out! Hoping to revisit some more features on this project again soon :)
It would be nice to be able to load a custom json file with a malboxgl style in it, instead of using mapbox ones.