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.

How to use different tile providers

See original GitHub issue

Just playing around with ipyleaflet - it’s a neat project! I wasn’t a big fan of the default OpenStreetMap tiles (too busy) so I figured out how to use MapBox tiles.

In case it’s of use for anyone else I’ve documented how to do so below. Since this isn’t a real issue per-se feel free to close…

Using Different Tile Providers

The underlying leaflet.js library is provider agnostic and can be used with almost any tile provider. A preview of freely available tile providers is available at http://leaflet-extras.github.io/leaflet-providers/preview/.

MapBox is a tile provider which has a free plan which requires signing up to get an access token. To use MapBox (as with any other provider) you simply provide the correct url to the TileLayer constructor - e.g.

url = "https://api.mapbox.com/v4/mapbox.outdoors/{z}/{x}/{y}.png?access_token=%s" % os.environ['MAPBOX_API_TOKEN']
provider = TileLayer(url=url, opacity=1)
m = Map(default_tiles=provider, center=(-27.4698, 153.0251), zoom=5)
m.layout.height = '800px'
m

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
SylvainCorlaycommented, Feb 22, 2018

We can now instantiate a tile layer by providing the URL of an existing tile service, or use one of the pre-registered tile layers as shown in the BaseMap example notebook.

strava-lab-view

0reactions
SylvainCorlaycommented, Jan 4, 2019

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use a different tile provider in openlayer3
You can use any tile map server as your tile source. Just create a XYZ tile source instead of an OSM source with...
Read more >
Leaflet - Can I use a different background tile provider ...
It's fine to use different tile sources for different zoom levels, just set the min and max zoom on each layer, and don't...
Read more >
MapProvider and Tiles - Unfolding Maps
This option enables switching between different tile providers for the same map. All map settings are persistent, i.e. current transformations, markers, ...
Read more >
bokeh.tile_providers — Bokeh 3.0.3 Documentation
Use a tile_providers.Vendors enumeration value, or the string name of one of the known providers. Use xyzservices.TileProvider to pass custom tile providers ......
Read more >
Tile Providers | The Data Visualization Workshop
geoplotlib supports the use of different tile providers. This means that any OpenStreetMap tile server can be used as a backdrop for our...
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