Skip to content

nagarajbhat/folium-visualization

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
img
 
 
 
 
 
 

Using python's Folium to create interactive maps

The blog post for this notebook can be found here .

Folium is a python library built on top of leaflet.js. It is used to visualize data through interactive maps, choropleth visualization, as well as parsing markers on data.

What will be covered in this notebook?

  • data preparation - merging,sorting, grouping using pandas. (step 1-5)
  • barplot visualization using seaborn (step 6)
  • creating maps using python's folium - tiles, circle marker, choropleth map, and geojson. (step7-9)
  • creating labels on the choropleth map using geojsontooltip. (step 10)
  • Displaying multiple data views on the same map using the "feature group" and control layer. (step 11)
  • Calculate market share(step 12)
  • Calculate the largest commodity in each district(step 13)
  • Create markers and use custom icons. (step 14)

Pitfalls to avoid

I broke my head for several hours so that you don't have to.

  • Avoid using jupyter lab in chrome, use firefox instead. Chrome did not render large maps. This will be useful in step 11.
  • While creating a choropleth map we will be using geojson data. Make sure the values in the key column (district name, or state) is the same across this file and the original data.
  • folium.Choropleth() doesn't provide an option for creating labels on top, use geojsontooltip along with it to create labels.

Data

  • You can find the data used in this notebook in the "data" folder.
  • References:
    1. "CommMktArrivals2012.xls" - Karnataka Agriculture market data by data.gov.in
    2. "kar.json" - Geojson map data for karnakata by Kenneth Mark Dsouza from here. Some of the districts name were corrected to suit "CommMktArrivals2012.xls".
    3. "kar_latlong.xlsx" - Latitude and longitude for each district in karnataka. This file was created by me.

About

Python's folium to visualize interactive maps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published