GeoPandas is a project to add support for geographic data to pandas objects. (See https://github.com/geopandas/geopandas)
It provides (among other cool things) a GeoDataFrame
object that represents a Feature collection.
When you have one, you may be willing to use it on a folium map. Here's the simplest way to do so.
In [1]:
%matplotlib inline
import geopandas
import sys
sys.path.insert(0,'..')
import folium
folium.__file__
Out[1]:
In this example, we'll use the same file as GeoPandas demo ; it's containing the boroughs of New York City.
In [2]:
boros = geopandas.GeoDataFrame.from_file('nybb.shp')
boros
Out[2]:
To create a map with these features, simply put them in a GeoJson
:
In [3]:
m = folium.Map([40.7,-74], zoom_start=10, tiles='cartodbpositron')
folium.GeoJson(boros).add_to(m)
m
Out[3]: