Geographical Data Visualization in Jupyter Notebook (ipyleaflet Tutorial Starts from 11'45")


1. Anaconda Python Download and Installation Guide

2. ipyleaflet Installation and Enabling Commands in Jupyter
!pip install ipyleaflet
!jupyter nbextension enable –py –sys-prefix ipyleaflet

3. Latitude and Longitude Coordinates of Major Cities in the U.S.
City Latitude Longitude
Atlanta 33.7490,-84.3880
Austin 30.2672,-97.7431
Boston 42.3601,-71.0589
Chicago 41.8781,-87.6298
Dallas 32.7766, -96.7969
Houston 29.7640,-95.3698
Los Angeles 34.0522,-118.2437
Miami 25.7617,-80.1918
New York City 40.7306,-73.935242
San Antonio 29.4241,-98.4936
San Francisco 37.7749, -112.4194
Washington D.C. 38.9072,-77.0369

4. You could meet the following error when running ipyleaflet
Could not create model:
Model name LeafletMapModel
Model module jupyter-leaflet
Model module version *
Script error for “jupyter-leaflet”

Solution 1:
Keep the script page with errors open, and then create a new script page. Write your map drawing commands in the new page.

Solution 2:
In the page with error, type in the following script in one script cell:
!jupyter nbextension enable –py –sys-prefix ipyleaflet

Then, create a new script cell, and create a trial map:
Map(center=[32.7766, -96.7969], zoom=10)

Note that the Map function must be typed in a separate script cell. If you still see the error, keep the page with error open, and then create a new notebook script page to code.



Write a comment