Friday, May 20, 2016

Using folium - 1: Use different map tiles (USGS style map)

Folium is an awesome tool that can make interactive maps built on Leaflet. I found it very easy to use. I will create a series of blog entries to show some of the plots that I usually use for my research.
Let's start with a simple map that change the tile to the style that USGS using for their earthquake page. I think the map tile looks good, here's an example from USGS. Also, there's a good website that you can checkout different map tiles that can be used in folium - Here. For the following code, you can download the notebook from Qingkai's Github
In [1]:
import folium
In [2]:
# Add the USGS style tile
url_base = 'http://server.arcgisonline.com/ArcGIS/rest/services/'
service = 'NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}'
tileset = url_base + service

map_1 = folium.Map(location=[37.8716, -122.2727], zoom_start=10,\
        control_scale = True, tiles=tileset, attr='USGS style')

map_1.add_children(
    folium.Marker([37.8716, -122.2727], popup = 'I am here'))
map_1
Out[2]:

2 comments:

  1. What an awesome and very nice post. I just stumbled upon your weblog and wanted to say that I’ve really enjoyed browsing your blog posts.

    In any case I will be subscribing to your rss feed and I hope you write again very soon!


    visit website

    ReplyDelete
    Replies
    1. Thanks Hill! Glad you like it, and thanks for subscribing the RSS. I will try to update every week with interesting things ^)^

      Delete