Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folium/Leaflet.js - an alternative way to plot the earthquake data #14

Open
kqdtran opened this issue Oct 20, 2013 · 7 comments
Open

Folium/Leaflet.js - an alternative way to plot the earthquake data #14

kqdtran opened this issue Oct 20, 2013 · 7 comments

Comments

@kqdtran
Copy link
Member

kqdtran commented Oct 20, 2013

Folium is a Python package we found out in OH today, and my group proceeded to install and play around with it as an alternative to BaseMap for plotting quakes. It allows you to plot the data in as few as 3 lines of code, using Leaflet.js under the hood.

Leaflet is a Javascript library with awesome interactive maps (and it's also mobile-friendly!). Everything is done in Python using Folium, so there's no html/css/javascript involved.

You can take a look at the examples in the docs to get started with Folium. Here's the interactive earthquake map my group made today http://bl.ocks.org/kqdtran/7063887. It's not really polished yet, but I guess it kinda works. The circle's radius is the magnitude of the quake, and if you click on the circle, it should show the information about the earthquake.

If you decide to play around with Folium, keep us all posted how that goes!

Edit: To install Folium, run sudo pip install folium on the command line!

@j-zhang
Copy link

j-zhang commented Oct 20, 2013

Thanks for sharing this other resource with us Khoa!

I opened up your interactive earthquake map in a new window, http://bl.ocks.org/kqdtran/raw/7063887/, and at first I didn't see the dots for earthquakes since I was going left on the map, and didn't see the one for Eureka, CA. But then when I opened the map again going in the rightward direction, I found all the earthquakes that you had plotted.

Just out of curiosity, do you have any idea why this might be? Since if you keep browsing in either direction, you come upon a number of North Americas...and the continents repeat themselves.

@kqdtran
Copy link
Member Author

kqdtran commented Oct 20, 2013

I unfortunately don't, Jody :(. Folium is still pretty new, so I haven't been able to google for any explanation yet. I'll just ask on the Issue Tracker of Folium itself and see what they say.

I guess an alternative and less confusing way would be to show the map once, so there should be no repeated continents... But I'll look into that.

@j-zhang
Copy link

j-zhang commented Oct 20, 2013

Understood, was just an observation since I initially had trouble finding the earthquakes.

Also, if you plot all of the 1,000+ earthquakes in the last week with magnitude 1.0, the map would get filled with clusters of earthquakes, right? I'm curious if even in California, for example, it would be harder to differentiate between earthquakes since the dots are pretty large right now. This is an interesting tool though, and many considerations to be made...maybe my group will look into this as a resource!

Right now we've been adjusting the existing code, and testing it on California, but are having trouble getting the right latitude and longitude coordinates as boundaries to the map, so the outline of California is not as clearly outlined like Alaska is. I did find this site: http://peak5390.wordpress.com/2012/12/08/matplotlib-basemap-tutorial-making-a-simple-map/, as a helpful resource for understanding how to use the matplotlib basemap tool. They were also interested in plotting global earthquake activity...

@kqdtran
Copy link
Member Author

kqdtran commented Oct 20, 2013

Right! I actually purposely make the dots big because I know the quakes are far apart. :D If the dots are a bit smaller, you can zoom in to the map to see different quakes happening in California as well.

That was a great link! Tbh though, I looked over the BaseMap tutorial and it seemed really complicated... so that's when we switched over to Folium...

@aculich
Copy link
Member

aculich commented Oct 21, 2013

I'm looking forward to seeing what you've done with Folium as an HTML5 alternative to using the IPython Notebook w/Basemap

@kqdtran
Copy link
Member Author

kqdtran commented Oct 25, 2013

Found this on HN http://sensitivecities.com/so-youd-like-to-make-a-map-using-python-EN.html, looks pretty relevant to what we're doing :D

@j-zhang
Copy link

j-zhang commented Oct 25, 2013

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants