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

Replace the use of stamen tiles in the repo #451

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions datashader_dashboard/datashader_dashboard.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"norms = odict(Histogram_Equalization='eq_hist', Linear='linear', Log='log', Cube_root='cbrt')\n",
"cmaps = odict([(n,colorcet.palette[n]) for n in ['fire', 'bgy', 'bgyw', 'bmy', 'gray', 'kbc']])\n",
"\n",
"maps = ['EsriImagery', 'EsriUSATopo', 'EsriTerrain', 'StamenWatercolor', 'StamenTonerBackground']\n",
"maps = ['EsriImagery', 'EsriUSATopo', 'EsriTerrain', 'EsriStreet', 'OSM']\n",
"bases = odict([(name, getattr(hvts, name)().relabel(name)) for name in maps])\n",
"gopts = hv.opts.Tiles(responsive=True, xaxis=None, yaxis=None, bgcolor='black', show_grid=False)\n",
"\n",
Expand Down Expand Up @@ -112,7 +112,7 @@
"\n",
" @pm.depends('show_labels')\n",
" def labels(self):\n",
" return hvts.StamenLabels().options(level='annotation', alpha=1 if self.show_labels else 0)\n",
" return hvts.EsriStreet().options(level='annotation', alpha=1 if self.show_labels else 0)\n",
"\n",
" def viewable(self,**kwargs):\n",
" rasterized = rasterize(hv.DynamicMap(self.elem), aggregator=self.aggregator, width=800, height=400)\n",
Expand Down Expand Up @@ -226,7 +226,7 @@
" dataplot = spreaded.opts(alpha=self.data_opacity, show_legend=False)\n",
" \n",
" tiles = self.basemap.opts(gopts).opts(alpha=self.map_opacity)\n",
" labels = hvts.StamenLabels().options(level='annotation', alpha=1 if self.show_labels else 0)\n",
" labels = hvts.EsriStreet().options(level='annotation', alpha=1 if self.show_labels else 0)\n",
" return tiles * dataplot * labels\n",
" \n",
"explorer2 = Explorer2(name=\"\")"
Expand Down
2 changes: 1 addition & 1 deletion landsat/landsat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
" col, rows = b.shape\n",
" return hv.RGB((xs, ys[::-1], b, b, b, a), vdims=list('RGBA'))\n",
"\n",
"tiles = hv.element.tiles.StamenToner()\n",
"tiles = hv.element.tiles.OSM()\n",
"tiles * shade(rasterize(one_band(bands[1])), cmap=['black', 'white']).redim(x='Longitude', y='Latitude')"
]
},
Expand Down
2 changes: 1 addition & 1 deletion ml_annotators/ml_annotators.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
"source": [
"rectangles = gv.Rectangles([(0, 0, 3, 3), (12, 12, 15, 15)]).opts(fill_alpha=0.2)\n",
"box_annotator = hv.annotate.instance()\n",
"labels = gv.tile_sources.StamenLabels()\n",
"labels = gv.tile_sources.EsriImagery()\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not EsriStreet like the others?

"layout = box_annotator(rectangles, name=\"Rectangles\")\n",
"\n",
"hv.annotate.compose(tiles, layout, labels)"
Expand Down
8 changes: 5 additions & 3 deletions ship_traffic/ship_traffic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"hv.output(backend='matplotlib')\n",
Expand Down Expand Up @@ -341,7 +343,7 @@
"points = hd.dynspread(hd.datashade(pts, aggregator=ds.count_cat('category'), color_key=color_key))\n",
"\n",
"tiles = hv.element.tiles.ESRI().opts(alpha=0.4, bgcolor=\"black\").opts(responsive=True, min_height=600)\n",
"labels = hv.element.tiles.StamenLabels().opts(alpha=0.7, level='glyph')\n",
"labels = hv.element.tiles.EsriUSATopo().opts(alpha=0.4, level='glyph')\n",
Comment on lines 345 to +346
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Azaya89 the code used to overlay an ESRI base map with the Stamen Labels layer that just contains labels (https://maps.stamen.com/toner-labels/#12/37.7922/-122.2301). With these changes, it is now overlaying two ESRI base maps, which doesn't make much sense. We've also lost the labels.

Let's go through these examples next week together.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I was thinking about it in a different way. See you next week then!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if we could find a labels-only tile set that still works, but I'm not aware of any. Failing that, I think the task is to choose an underlying tile set with labels embedded in it already in a way that is not too distracting. I do think people need labels, because otherwise it's hard to orient yourself. But with many tile sets, the labels are rendered in a way that becomes extremely busy when dense data is overlaid on them. So there's definitely some trial and error involved and tradeoffs to make.

"\n",
"tiles * labels * points.opts(show_legend=False) * legend.opts(xaxis='bare',yaxis='bare', title='')"
]
Expand Down Expand Up @@ -509,7 +511,7 @@
"sopts = dict(start=0, end=1, sizing_mode='stretch_width')\n",
"map_opacity = pn.widgets.FloatSlider(value=0.7, name=\"Map opacity\", **sopts)\n",
"data_opacity = pn.widgets.FloatSlider(value=1.0, name=\"Data opacity\", **sopts)\n",
"label_opacity = pn.widgets.FloatSlider(value=0.9, name=\"Label opacity\", **sopts)\n",
"label_opacity = pn.widgets.FloatSlider(value=0.3, name=\"Label opacity\", **sopts)\n",
"overlay = (tiles.apply.opts(alpha=map_opacity) *\n",
" pointsp.apply.opts(alpha=data_opacity, show_legend=False) * vessel_name_raster *\n",
" labels.apply.opts(alpha=label_opacity) * highlight * legend)\n",
Expand Down
Loading