├── .ipynb_checkpoints └── sf_crime_mapping_final-checkpoint.ipynb ├── README.md ├── SFPD_Incidents_-_Current_Year__2016_.csv ├── sf_assaults.html ├── sf_census_tracts.cpg ├── sf_census_tracts.dbf ├── sf_census_tracts.prj ├── sf_census_tracts.sbn ├── sf_census_tracts.sbx ├── sf_census_tracts.shp ├── sf_census_tracts.shp.xml ├── sf_census_tracts.shx ├── sf_crime_mapping_final.html ├── sf_crime_mapping_final.ipynb ├── sf_crime_mapping_final.md └── static_map.png /README.md: -------------------------------------------------------------------------------- 1 | # Creating Web Maps in Python with GeoPandas and Folium 2 | 3 | ![title](static_map.png) 4 | 5 | [Live Version](https://rawgit.com/agaidus/leaflet_webmaps_python/master/sf_assaults.html) 6 | 7 | In this post, I demonstrate the use of the Python package Folium to create a web map from a GeoDataFrame. Folium is built on the Leaflet javascript library, which is a great tool for creating interactive web maps. However, I use Python for all of my data wrangling and analytical tasks, so it's really nice to be able to have the web-mapping capabilities from within the same environment. The goal of this post is to demonstrate a workflow between GeoPandas and Folium that makes it really easy to create functional and visually appealing web maps in Python. 8 | 9 | In this example, I plot the point locations of crimes in San Francisco, overlaid on a choropleth of census tract crime density. Viewing these two layers together on a web map creates a nice way to get an overall sense of crime distribution, while also being able to view individual crime information. As I demonstrate below, these Python packages provide a nice, clean, and customizable way of doing this. 10 | 11 | [Jupyter Notebook](sf_crime_mapping_final.ipynb) 12 | 13 | [HTML Version](https://rawgit.com/agaidus/leaflet_webmaps_python/master/sf_crime_mapping_final.html) 14 | 15 | -------------------------------------------------------------------------------- /sf_census_tracts.cpg: -------------------------------------------------------------------------------- 1 | UTF-8 -------------------------------------------------------------------------------- /sf_census_tracts.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agaidus/leaflet_webmaps_python/efcdfeec8fdebb95074ed6386d16b74b6d11ed57/sf_census_tracts.dbf -------------------------------------------------------------------------------- /sf_census_tracts.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD_1983_California_Teale_Albers",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Albers"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",-4000000.0],PARAMETER["Central_Meridian",-120.0],PARAMETER["Standard_Parallel_1",34.0],PARAMETER["Standard_Parallel_2",40.5],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /sf_census_tracts.sbn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agaidus/leaflet_webmaps_python/efcdfeec8fdebb95074ed6386d16b74b6d11ed57/sf_census_tracts.sbn -------------------------------------------------------------------------------- /sf_census_tracts.sbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agaidus/leaflet_webmaps_python/efcdfeec8fdebb95074ed6386d16b74b6d11ed57/sf_census_tracts.sbx -------------------------------------------------------------------------------- /sf_census_tracts.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agaidus/leaflet_webmaps_python/efcdfeec8fdebb95074ed6386d16b74b6d11ed57/sf_census_tracts.shp -------------------------------------------------------------------------------- /sf_census_tracts.shp.xml: -------------------------------------------------------------------------------- 1 | 2 | 20161104160531001.0TRUECalculateField TRACTS_10_ECA_TAprj FIPS [FIPS] VB #CalculateField TRACTS_10_ECA_TAprj FIPS [TractFIPS] VB #CalculateField CA_CensusTracts10 FIPS10 [FIPS] VB #CalculateField CA_Tracts10 CTFIPS10 [FIPS10] VB # 3 | -------------------------------------------------------------------------------- /sf_census_tracts.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agaidus/leaflet_webmaps_python/efcdfeec8fdebb95074ed6386d16b74b6d11ed57/sf_census_tracts.shx -------------------------------------------------------------------------------- /static_map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agaidus/leaflet_webmaps_python/efcdfeec8fdebb95074ed6386d16b74b6d11ed57/static_map.png --------------------------------------------------------------------------------