Before making a WebMap, ask yourself:
WebMaps are great for exploring or communicating data that necessitate changing scale, area and comparing data to general spatial features (base maps) to comprehend.
To take an example from last lesson, the airline flights example is quite a good example of this. You can focus on an individual airport, specific regions (e.g., Greenland vs Africa) or the world. If I wanted to improve that map I could make it that clicking on an airport highlights those flights in particular.
The skills required for WebMap development
Last week had some technical background taking time last week, but it’s necessary, and while we will be making WebMaps this week, we’ll continue to use the knowledge from last week and develop new skills.
I will create a folder on my website named test
.
It has two html files inside, named:
When I use the browser to navigate to the folder named test
, what do you expect to happen?
What actually happens, and why?
SSH onto the server, into my user account's public_html and:
test
index.html
with the contentinfo.html
with the contentDownload the zip file for this lesson.
Being organized and clean in terms of files and folders will be very important
For the remainder of the course you will be contributing to building up your website (i.e., this folder's contents).
Note the importance of the index.html file:
Our server for this course: http://164.92.179.32
I will individually give you your passwords now
The purpose of WebMaps is to provide spatial data interaction/exploration online. Typically WebMaps are placed within a website providing the context - similar to what you have done in esri’s Story Maps. Hopefully at this stage you have a working mini-website working on your local machine.
We need to learn how to put our content on-line.
Placing content on-line requires having a computer permanently on and connected to the internet that is running software that can respond to requests for information, what we call a server.
I have spun up a temporary server using DigitalOcean. It costs about 7 EUR per month. Cheaper options exist (e.g., 20 EUR/year).
A note on your using this server.
Always keep a good copy of your data on your local machine.
This server will not be active beyond the final assignment submission deadline.
We saw last week how paths and relative paths 'match'.
While this relationship is maintained once you put data on the server, where your 'root' webpath and URL meet can be arbitrary.
However, this is typically standardized. If want an html file to appear at your URL: http://164.92.179.32/~cyrille
then you must place your index.html
file at the location /home/cyrille/public_html/index.html
.
You may have to create the public_html
directory and set permissions to 755
.
There are various methods and tools we can use to upload.
A common introductory method to move files between your computer and the server is FTP (File transfer protocol).
Don't use this as it's insecure.
We now use SFTP (Secure FTP).
We will use software called FileZilla, a good, free, and cross-platform (S)FTP client.
We are using FileZilla Client (not FileZilla Server)
We might talk about using FTP generally but we always mean SFTP.
If you download the FileZilla, you want the Client, not the FileZilla Server!
The basics:
To connect to the server, configure FileZilla by opening the Site Manager:
It should have a main index.html page, and an aboutme.html page.
We will create our first WebMap using the Leaflet library.
The Quick Start Guide assumes we have some knowledge of HTML.
template.html
in resources_wk2/website/pages/
leaflet_example.html
(or something clear) in the same folder.leaflet_example.html
in your code editor of choice (e.g., Notepad++)Follow the instructions on the Quick Start Guide and integrate the resources (CSS, JS, HTML) into your file.
Look in the provided resources/A_tale_of_two_codes to see the two files below (here abridged to fit):
<head> <title>Integrated Leaflet WebMap</title> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css"/> <script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js"></script> <style> #map { height: 180px; } </style> </head> <body> <div id="map"></div> <script> var map = L.map('map').setView([51.505, -0.09], 13); L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', maxZoom: 18, id: 'mapbox/streets-v11', tileSize: 512, zoomOffset: -1, accessToken: 'your.mapbox.access.token' }).addTo(map); </script> </body>
<head> <title>Separated Leaflet WebMap</title> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css"/> <script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js"></script> <link rel="stylesheet" href="separated.css"/> </head> <body> <div id="map"></div> <script src="separated.js"></script> </body>
/* separated.css */#map { height: 180px; }
// separated.jsvar map = L.map('map').setView([51.505, -0.09], 13);L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', maxZoom: 18, id: 'mapbox/streets-v11', tileSize: 512, zoomOffset: -1, accessToken: 'your.mapbox.access.token'}).addTo(map);
On the left the three, HTML, CSS, and JS are integrated.
On the right are the contents of separate files. The HTML, CSS, and JS.
In the <head>
:
In the <body>
:
<div id="something"></div>
that will contain your WebMap.id
:Just like we linked HTML to CSS and JS files, we can now link to HTML elements, using CSS and JS.
You will follow the directions for the following sections:
If after all that work...
What's the problem? Use F12 - the developer console!
I will do an overview of the activity steps first.
Explain why this is doomed to failure.
As you've seen from the previous exercise, the tiles you are using belong to Mapbox, created from OSM data.
As we will not be generating our own tiles in this course we need to use someone's image tiles*. Mapbox's business is providing tools and resources, such as these tiles.
There are many sources of map tiles, many of which you must register and retrieve a key
to be able to use.
If you exceed certain usage limits you will be cut-off and required to pay to continue.
Unless you have a popular site or WebMap you're unlikely to reach the non-free tiers from Mapbox or other services.
* We could make our own tiles, but that's beyond this course's scope.
Many alternative map sources exists to Mapbox:
Either update your L.tileLayer
source (and attribution!) to an alternative source or register with Mapbox and update the accessToken
.
Some alternative tile layers:
You can now go back to do the activity, you must choose whether to use the Mapbox tiles or another resource.
Feel free to ask each other for assistance, or myself.
Use the instructions and code above and in the resources zip file to help you complete the tasks.
While adding following the tutorial you must think about what you are doing and not just copy code.
We will dive straight into another activity. Making a WebMap of certain flight paths of your choice.
The process is as follows:
The data for this exercise is provided in the zipped resources provided for today.
Explore how to do the following activities in QGIS:
Here's a demonstration
You should replicate the process for an airport of your choice other than Luxembourg.
You must keep your individual WebMap files very organized in separate folders.
If your files for this course are a mess things will become much much harder to resolve for you.
Beyond just updating these two maps, you must update your main index.html file that we worked on first today, to point/link to the two new maps.
Finish the exercises from today's lecture:
Create new WebMaps:
SSH in as root:
apt install apache2apache2 -version# Configure firewallufw allow 'Apache'ufw allow 'OpenSSH'ufw status# activate firewallufw enableufw status# it should show Apache and OpenSSH enabled# check website in browser# Note we are using http and not https# update the main landing pagevim /var/www/html/index.html# use newusers (for usage see: man newusers) to create users from file# use the following format (we leave a few blank):# name:passwd:uid:group:gecos:dir:shell# cyrille:8t3n997zqb::student::/home/cyrille:
# generate users from file contentsnewusers students_list# Enable user directoriesa2enmod userdirsystemctl restart apache2# make user dirs subdirectories 'visible' to Apachechmod 755 /home/*# Enable sftp for the user group 'students' in # From /etc/ssh/sshd_config comment outSubsystem sftp /usr/libexec/openssh/sftp-server# addSubsystem sftp internal-sftp# and add at the bottomMatch Group students # if doesn't work use 'User bob,joe,jim'ChrootDirectory /homeX11Forwarding noAllowTcpForwarding noAllowAgentForwarding noForceCommand internal-sftpPasswordAuthentication yes# then restart the service/etc/init.d/ssh restart
Before making a WebMap, ask yourself:
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
o | Tile View: Overview of Slides |
Esc | Back to slideshow |
Before making a WebMap, ask yourself:
WebMaps are great for exploring or communicating data that necessitate changing scale, area and comparing data to general spatial features (base maps) to comprehend.
To take an example from last lesson, the airline flights example is quite a good example of this. You can focus on an individual airport, specific regions (e.g., Greenland vs Africa) or the world. If I wanted to improve that map I could make it that clicking on an airport highlights those flights in particular.
The skills required for WebMap development
Last week had some technical background taking time last week, but it’s necessary, and while we will be making WebMaps this week, we’ll continue to use the knowledge from last week and develop new skills.
I will create a folder on my website named test
.
It has two html files inside, named:
When I use the browser to navigate to the folder named test
, what do you expect to happen?
What actually happens, and why?
SSH onto the server, into my user account's public_html and:
test
index.html
with the contentinfo.html
with the contentDownload the zip file for this lesson.
Being organized and clean in terms of files and folders will be very important
For the remainder of the course you will be contributing to building up your website (i.e., this folder's contents).
Note the importance of the index.html file:
Our server for this course: http://164.92.179.32
I will individually give you your passwords now
The purpose of WebMaps is to provide spatial data interaction/exploration online. Typically WebMaps are placed within a website providing the context - similar to what you have done in esri’s Story Maps. Hopefully at this stage you have a working mini-website working on your local machine.
We need to learn how to put our content on-line.
Placing content on-line requires having a computer permanently on and connected to the internet that is running software that can respond to requests for information, what we call a server.
I have spun up a temporary server using DigitalOcean. It costs about 7 EUR per month. Cheaper options exist (e.g., 20 EUR/year).
A note on your using this server.
Always keep a good copy of your data on your local machine.
This server will not be active beyond the final assignment submission deadline.
We saw last week how paths and relative paths 'match'.
While this relationship is maintained once you put data on the server, where your 'root' webpath and URL meet can be arbitrary.
However, this is typically standardized. If want an html file to appear at your URL: http://164.92.179.32/~cyrille
then you must place your index.html
file at the location /home/cyrille/public_html/index.html
.
You may have to create the public_html
directory and set permissions to 755
.
There are various methods and tools we can use to upload.
A common introductory method to move files between your computer and the server is FTP (File transfer protocol).
Don't use this as it's insecure.
We now use SFTP (Secure FTP).
We will use software called FileZilla, a good, free, and cross-platform (S)FTP client.
We are using FileZilla Client (not FileZilla Server)
We might talk about using FTP generally but we always mean SFTP.
If you download the FileZilla, you want the Client, not the FileZilla Server!
The basics:
To connect to the server, configure FileZilla by opening the Site Manager:
It should have a main index.html page, and an aboutme.html page.
We will create our first WebMap using the Leaflet library.
The Quick Start Guide assumes we have some knowledge of HTML.
template.html
in resources_wk2/website/pages/
leaflet_example.html
(or something clear) in the same folder.leaflet_example.html
in your code editor of choice (e.g., Notepad++)Follow the instructions on the Quick Start Guide and integrate the resources (CSS, JS, HTML) into your file.
Look in the provided resources/A_tale_of_two_codes to see the two files below (here abridged to fit):
<head> <title>Integrated Leaflet WebMap</title> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css"/> <script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js"></script> <style> #map { height: 180px; } </style> </head> <body> <div id="map"></div> <script> var map = L.map('map').setView([51.505, -0.09], 13); L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', maxZoom: 18, id: 'mapbox/streets-v11', tileSize: 512, zoomOffset: -1, accessToken: 'your.mapbox.access.token' }).addTo(map); </script> </body>
<head> <title>Separated Leaflet WebMap</title> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css"/> <script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js"></script> <link rel="stylesheet" href="separated.css"/> </head> <body> <div id="map"></div> <script src="separated.js"></script> </body>
/* separated.css */#map { height: 180px; }
// separated.jsvar map = L.map('map').setView([51.505, -0.09], 13);L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', maxZoom: 18, id: 'mapbox/streets-v11', tileSize: 512, zoomOffset: -1, accessToken: 'your.mapbox.access.token'}).addTo(map);
On the left the three, HTML, CSS, and JS are integrated.
On the right are the contents of separate files. The HTML, CSS, and JS.
In the <head>
:
In the <body>
:
<div id="something"></div>
that will contain your WebMap.id
:Just like we linked HTML to CSS and JS files, we can now link to HTML elements, using CSS and JS.
You will follow the directions for the following sections:
If after all that work...
What's the problem? Use F12 - the developer console!
I will do an overview of the activity steps first.
Explain why this is doomed to failure.
As you've seen from the previous exercise, the tiles you are using belong to Mapbox, created from OSM data.
As we will not be generating our own tiles in this course we need to use someone's image tiles*. Mapbox's business is providing tools and resources, such as these tiles.
There are many sources of map tiles, many of which you must register and retrieve a key
to be able to use.
If you exceed certain usage limits you will be cut-off and required to pay to continue.
Unless you have a popular site or WebMap you're unlikely to reach the non-free tiers from Mapbox or other services.
* We could make our own tiles, but that's beyond this course's scope.
Many alternative map sources exists to Mapbox:
Either update your L.tileLayer
source (and attribution!) to an alternative source or register with Mapbox and update the accessToken
.
Some alternative tile layers:
You can now go back to do the activity, you must choose whether to use the Mapbox tiles or another resource.
Feel free to ask each other for assistance, or myself.
Use the instructions and code above and in the resources zip file to help you complete the tasks.
While adding following the tutorial you must think about what you are doing and not just copy code.
We will dive straight into another activity. Making a WebMap of certain flight paths of your choice.
The process is as follows:
The data for this exercise is provided in the zipped resources provided for today.
Explore how to do the following activities in QGIS:
Here's a demonstration
You should replicate the process for an airport of your choice other than Luxembourg.
You must keep your individual WebMap files very organized in separate folders.
If your files for this course are a mess things will become much much harder to resolve for you.
Beyond just updating these two maps, you must update your main index.html file that we worked on first today, to point/link to the two new maps.
Finish the exercises from today's lecture:
Create new WebMaps:
SSH in as root:
apt install apache2apache2 -version# Configure firewallufw allow 'Apache'ufw allow 'OpenSSH'ufw status# activate firewallufw enableufw status# it should show Apache and OpenSSH enabled# check website in browser# Note we are using http and not https# update the main landing pagevim /var/www/html/index.html# use newusers (for usage see: man newusers) to create users from file# use the following format (we leave a few blank):# name:passwd:uid:group:gecos:dir:shell# cyrille:8t3n997zqb::student::/home/cyrille:
# generate users from file contentsnewusers students_list# Enable user directoriesa2enmod userdirsystemctl restart apache2# make user dirs subdirectories 'visible' to Apachechmod 755 /home/*# Enable sftp for the user group 'students' in # From /etc/ssh/sshd_config comment outSubsystem sftp /usr/libexec/openssh/sftp-server# addSubsystem sftp internal-sftp# and add at the bottomMatch Group students # if doesn't work use 'User bob,joe,jim'ChrootDirectory /homeX11Forwarding noAllowTcpForwarding noAllowAgentForwarding noForceCommand internal-sftpPasswordAuthentication yes# then restart the service/etc/init.d/ssh restart