question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tile sources as param widgets

See original GitHub issue

I wrote this bit of code so that I can display the tile sources as widgets. It seems like it might be useful in geoviews itself:

import geoviews as gv
import geoviews.tile_sources as gvts
import param
import panel as pn

class GVTS(param.Parameterized):
    
    source = param.ObjectSelector(default=list(gvts.tile_sources.keys())[0], objects=list(gvts.tile_sources.keys()), label='Web Map Tile Services')
        
    def widget(self):
        return pn.panel(self.param, parameters=['source'])
    
    @param.depends('source')
    def view(self):
        return gvts.tile_sources[self.source]
    
    def panel(self):
        return pn.Column(self.widget, self.view)

image

I’m not super happy with the syntax on the tile sources in the ObjectSelector. I wanted to do something like this:
source = param.ObjectSelector(default=gvts.tile_sources['EsriImagery'], objects=gvts.tile_sources, label='Web Map Tile Services')

But that gave me extra widgets that I didn’t want to expose to the user and I couldn’t see a way around it. I suspect its due to the use of dict as ObjectSelector.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jsignellcommented, Oct 16, 2019

I just came across this issue and think it should be closed. Unless someone wants to add a snippet to the docs. Here is an (arguably) simpler version using @pn.depends

import panel as pn
import geoviews.tile_sources as gvts

tiles_widget = pn.widgets.Select(options=gvts.tile_sources, name='Web Map Tile Services')

@pn.depends(tiles_widget)
def tile_plot(tile): 
    return tile

pn.Row(tiles_widget, tile_plot)
0reactions
jbednarcommented, May 14, 2019

I’m a bit confused; to me the grabcut.py files seem messy because they are using string URLs rather than gvts.tile_sources, but that’s a matter of updating grabcut.py rather than GeoViews. I’m not able to see just what would go into GeoViews that would be reusable, beyond tile_sources that’s already in GeoViews. I must be missing something?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Widgets Dictionary - XWiki - the EasyVista Wiki
When you use a Custom Widget, the related data sources are automatically created. Check that they are well formed (all parameters correctly ...
Read more >
ListTile class - material library - Flutter - Dart API docs
A list tile contains one to three lines of text optionally flanked by icons or other widgets, such as check boxes. The icons...
Read more >
Add tms and zoomOffset options to TileLayer #31 - GitHub
I'm trying to use some tiles I generated with custom maps. ... TileLayer cannot change all the parameter leaflet.tilelayer (here) would accept.
Read more >
Catalog of Out Of Box widgets you can add to a dashboard
Widgets display information and charts on dashboards. Many widgets are configurable or are scoped to a team or to the logged in user...
Read more >
Built-in Widgets - Qtile Docs
If the change_command parameter is set to None, the widget will attempt to use ... .org/user_builds/qtile/checkouts/latest/libqtile/resources/battery-icons'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found