from pyspatial.vector import read_layer
from pyspatial.visualize import get_latlngs, HTMLMap
import cPickle as pickle
import pandas as pd
from pyspatial.utils import projection_from_epsg
vl, vldf = read_layer("../test/data/vector/cb_2014_us_state_20m.zip", index="STUSPS")
# Get a resonable center for the map
centroid = vl["KS"].Centroid()
lng, lat, z = centroid.GetPoint()
# Initialize the map
hmap = HTMLMap(lat, lng, data=vldf)
popup_text = ["California", "New York"]
hmap.add_markers("markers", vl[["CA", "NY"]], text=popup_text)
# For styling refer to http://leafletjs.com/reference.html#path
hmap.add_shapes("shapes", vl[["CA", "NY"]], text=popup_text, style={"fillColor": "red"})
hmap.render_ipython()