Saving the map

To save the choropleth map, use the create_html method of the visualization:

with open('mpop.html', 'w') as f:    f.write(vizClor.create_html())

To view the saved HTML file locally, open command prompt and start a local HTTP server using Python in the same folder as the saved HTML file. Then, open a browser at http://localhost:8000/mpop.html to see the map:

C:\Python3Geospatial>python -m http.serverServing HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...

Get Mastering Geospatial Analysis with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.