Open psychemedia opened 7 years ago
@psychemedia
Why do you use links
with tileserver-gl?
Do you want to access from your jupyterscipy
image to tileserver
image using http://tileserver/data/v3/{z}/{x}/{y}.pbf
url?
https://gist.github.com/smellman/e6e839fa1cc10e7e2008f9a7bf72aa70 In my case, varnish cache access to raster-tileserver(s) using 80 port.
@smellman re: Do you want to access from your jupyterscipy image to tileserver image using http://tileserver/data/v3/{z}/{x}/{y}.pbf url?
Yes... Ideally, I want to be able to use folium
python package in notebook to render maps in Jupyter notebook with tiles served from the tileserver-gl
container.
@psychemedia How about following code?
tileset = r'http://localhost:8085/styles/klokantech-basic/{z}/{x}/{y}.png'
# tileset = r'http://localhost:8085/styles/{your style}/{z}/{x}/{y}.png'
map = folium.Map(location=[45.372, -121.6972], zoom_start=12,
tiles=tileset, attr='your attribution message')
folium seems make leaflet container, it means Jupyter notebook and folium don't care about local access to tile, it only need access from browser.
@smellman Yes, doh!, of course... also realised my issue was with serving .pbf rather than png. I thought I'd seen a folium
demo of that working but I must have imagined it...
I guess I need to rethink doing something built around mapbox-gl.js
?
@psychemedia You can access via http://localhost:8085/data/v3.json
or directly http://localhost:8085/data/v3/{z}/{x}/{y}.pbf
.
But folium
doesn't support Mapbox GL JS yet.
https://github.com/python-visualization/folium/issues/416#issuecomment-248753090
See this comment and check folium
repository (or to become contributor:-) ).
If you want to only embed map in Jupyter Notebooks , this article seem good. https://www.ryanbaumann.com/blog/2016/4/3/embedding-mapbox-plots-in-jupyter-notebooks Also, you need change javascript code in this article.
// mapboxgl.accessToken = 'pk.eyJ1IjoicnNiYXVtYW5uIiwiYSI6IjdiOWEzZGIyMGNkOGY3NWQ4ZTBhN2Y5ZGU2Mzg2NDY2In0.jycgv7qwF8MMIWt4cT0RaQ';
var map = new mapboxgl.Map({
container: 'map', // container id
style: 'http://localhost:8085/styles/klokantech-basic/style.json', //stylesheet location
center: [-89.948470, 40.783860], // starting position
zoom: 10 // starting zoom
});
@smellman Thanks.. I thought I'd seen a connection string example using .pbf
and assumed that meant handling was autodetected. But I must have been mistaken (can't find it anywhere now...)
Will have a play when I get back from a w/e away and see if I can figure out to patch folium
, if indeed @ryanbaumann hasn't already done so...
@psychemedia another good notebook if you're looking at how to integrate Mapbox GL into Jupyter notebooks (from last year):
Are there any examples of using
tileserver-gl
with linked containers launched usingdocker-compose
?For example
Related to this, is it possible to define the Dockerfile such that it would allow the setting of environment variables in the
docker-compose.yaml
file that would allow the setting of the-b
,--bind
(bind address) ?but can seem to load any served tiles in a map in a Jupyter notebook in the linked Jupyter container?
I'm wondering if it's a bind issue?