Tuesday, June 14, 2016

Using folium - 4: Draw lines (Plot San Andreas Fault)

In this blog, we will plot the San Andreas Fault on the Folium map using PolyLine. I just plot the approximate location based on some locations that I got from this figure. You can download this script from Qingkai's Github.
In [1]:
import folium
In [2]:
places_on_SAF = [('Point Delgada', 40.0215325, -124.0691973),
('Point Arena', 38.9088, -123.6931),
('Point Reyes', 38.0440, -122.7984),
('Daly City', 37.6879, -122.4702),
('Bautista', 36.8455, -121.5380),
('Parkfield', 35.8997, -120.4327),
('Cholame', 35.7239, -120.2965),
('Bitter Creek National Wildlife Refuge', 34.9342, -119.4005),
('Frazier Park', 34.8228, -118.9448),
('Palmdale', 34.5794, -118.1165),
('San Bernardino', 34.1083, -117.2898),
('Desert Hot Springs', 33.9611, -116.5017),
('Salton Sea State Recreation Area', 33.5088, -115.9181)]

# get the coordinates for these places
lats = [x[1] for x in places_on_SAF]
lons = [x[2] for x in places_on_SAF]
coordinates = zip(lats, lons)
In [3]:
m = folium.Map(location=[36.5,-122], zoom_start=6, tiles='Stamen Terrain')
# Create the map with the appoximate location of San Andreas Fault
SAF=folium.PolyLine(locations=coordinates,weight=5,color = 'red')
m.add_children(SAF)
Out[3]:


Issues for plotting lines

Currently, it seems Folium can not handle the date changing line very well. For example, when I try to plot the plate boundary on the map, I got the following figure. I also tested this on Basemap, which share the same problem as Folium. The only one handles this problem well is Cartopy.

Example from Folium

Example from Cartopy

4 comments:

  1. I am having the same issue when I am plotting the multiple polyline data on map, did you get any solutions, can you let me know what you did?

    ReplyDelete
  2. Your selection of topic is very good and also well written. Thanks for sharing. I feel like all your ideas are incredible! Great job!!!

    Best Marble Background

    ReplyDelete
  3. Truly, this article is really one of the very best in the history of articles. I am a antique ’Article’ collector and I sometimes read some new articles if I find them interesting. And I found this one pretty fascinating and it should go into my collection. Very good work! Fault Location Services Germantown

    ReplyDelete
  4. 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