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]:

5 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
  2. You have a very interesting blog. Someday, can you also post how do you embed these maps in our blog?

    ReplyDelete
  3. Five weeks ago my boyfriend broke up with me. It all started when i went to summer camp i was trying to contact him but it was not going through. So when I came back from camp I saw him with a young lady kissing in his bed room, I was frustrated and it gave me a sleepless night. I thought he will come back to apologies but he didn't come for almost three week i was really hurt but i thank Dr.Azuka for all he did i met Dr.Azuka during my search at the internet i decided to contact him on his email dr.azukasolutionhome@gmail.com he brought my boyfriend back to me just within 48 hours i am really happy. What’s app contact : +44 7520 636249‬

    ReplyDelete