Universiteit Leiden

Mapping exercises

Option 1.

  •  Open Jupyter Notebook
  • Click on “New” > “Python 3”
  • In the first cell on the new notebook that is opened, copy the code below.

 


import requests
from os.path import basename

urls = [
'pisa_read.csv',
'nl.geojson',
'nl_population.csv',
'new_york.geojson',
'mapping.ipynb',
'mapp.csv',
'map.csv',
'europe.geojson',
'addresses.csv' ]

base_url = 'https://raw.githubusercontent.com/peterverhaar/DigitalMediaTechnology/master/'

for url in urls:

    response = requests.get(base_url + url)

    if response:
        file_name = url
        notebook = response.text
        with open(file_name,'w',encoding='utf-8') as out:
            out.write(notebook)

 

  •  Next, run the cell, by clicking on [Shift] + [Enter]
  • The code should have downloaded the tutorial on interactive mapping. The file is named ‘mapping.ipynb’.
  • Open the dashboard again, and refresh the page, if necessary.
  • Open the notebook named 'mapping.ipynb'

 

Option 2.

If you cannot work with Jupyter Notebook, for whichever reason, you can also open the file in Google Collab.