Stratplotlib is a custom, open source mapping tool that allows users to easily interactively visualize geospatial data. The tool works by creating a base map object that is used for the addition of various visualization layers.
Stratplotlib was created as part of Stratodem Analytics’ mapping and plotting platform and is built on top of folium, matplotlib and leaflet. It is designed for the simplistic integration of many elements into a map plotting while largely assuming the use of pandas.DataFrames as the underlying data structure of the user.
Stratplotlib currently provides 5 APIs for different geospatial visualizations:
- choropleth, assigns a shade of a color to an area – plots a value “gradient” over space
- groupmap, assigns distinct colors to different area groups
- scatter, plots a set of (x,y) coordinates into the map
- marker, plots a set of (x,y) coordinates as polygon markers into the map
- line, draws a line between a source and a destination point
Examples
from stratplotlib import stratomap
m = stratomap()
m.choropleth(df, value_col=‘VALUES’, geometry_col=‘GEOMETRY’)
m.save(‘map.html’)
from stratplotlib import stratomap
m = stratomap()
m.choropleth(df, value_col=‘VALUES’, geometry_col=‘GEOMETRY’)
m.save(‘map.html’)
m = stratomap()
m.scatter(df, x_col=‘x’, y_col=‘y’, color=‘red’)
m.line(source=list_of_source, target=list_of_dest, color=‘yellow’)
m.marker(x, y, number_of_sides=3, fill_color=‘black’, color=‘green’, rotation=30)
m.show()
m = stratomap()
m.line(source=list_of_source, target=list_of_dest, color=‘red’, weight=list_of_weights)
m.show()
m = stratomap()
m.set_tiles(‘cartodbdark_matter’)
m.scatter(df, x_col=‘LONGITUDE’, y_col=‘LATITUDE’, color=‘yellow’, scale=5, value_col=‘VALUES’)
m = stratomap()
m.groupmap(df, group_col=‘GROUP’, geometry_col=‘GEOMETRIES’)