Hello, future map maker! Have you ever used Google Maps to find your way? Or seen a map on a website that shows where a restaurant is? That is a web map. A web map lives inside a web page. It can move, zoom, and show you many kinds of information.
In this module, you will learn how to build your own web maps using two free tools called OpenLayers and MapLibre. These are computer programs (we call them libraries) that help you put maps on a website. You do not need to be a genius. You only need to be curious and ready to try.
This module is the first step. We will start with the very basics: what a map is, what the internet has to do with maps, and how to make a simple map appear on a screen. We will use simple words and many examples. By the end, you will understand how to set up your own map project and show a map of the world. Letβs begin!
After you finish this module, you will be able to:
Once upon a time, in the busy city of Lagos, there was a boy named Tunde. Tunde loved to explore. One day, his grandmother gave him an old paper map. βThis map shows all the streets of Lagos,β she said. βBut it cannot move or change.β
Tunde took the map outside. He tried to find his friendβs house, but the map was torn and old. He wished the map could show him exactly where he was and what was around him. Suddenly, a small fairy appeared. βI am the Map Fairy,β she said. βI will show you something better than paper. It is called a web map.β
The fairy waved her wand, and a glowing rectangle appeared in the air. It looked like a window. Inside the window, Tunde saw the streets of Lagos moving and zooming. He could see his school, the market, and even his own house. βWow!β he shouted. βHow does it work?β
βIt is made with special tools called OpenLayers and MapLibre,β said the fairy. βThey are like magic paintbrushes for the internet. You can learn to use them too.β Tunde was so happy. He decided to learn everything about web maps. And that is exactly what you will do in this module.
Moral of the story: Old maps are static (they donβt change). Web maps are dynamic (they can move, zoom, and show new information). With the right tools, anyone can make a web map.
Definition: A map is a drawing of an area, usually seen from above. It shows where things are.
Why it is important: Maps help us find places, understand distances, and plan journeys.
Simple explanation: Imagine you draw your bedroom on a paper. You mark your bed, your door, and your window. That is a map.
Real-life example: A tourist uses a map to find a hotel.
School example: Your teacher draws a map of the classroom on the board.
Home example: Your parents might draw a map to show you where the fuse box is.
Nigerian example: A map of Nigeria shows all 36 states and the Federal Capital Territory, Abuja.
Illustration:
+-------------------+ | ποΈ Bed | | | | πͺ Door | | | | πͺ Window | +-------------------+ My Bedroom Map
Mini summary: A map is a top-down drawing of a place. It helps you see where things are.
Definition: A web map is a map that lives on a website. You can move it, zoom in, and click on it.
Why it is important: Web maps are interactive. They can show live traffic, weather, or where your friends are.
Simple explanation: If you open Google Maps on a phone or computer, that is a web map. It is not printed on paper.
Real-life example: When you order a ride, you see the car moving on a web map.
School example: A school website might have a web map showing the location of the school.
Home example: You can check a web map to see how long it takes to walk to the market.
Nigerian example: The Lagos State Government website might have a web map showing flood areas.
Illustration:
+---------------------+ | WEB MAP | | [π] [π +] [π -]| | You can move me! | +---------------------+
Mini summary: A web map is a map inside a web page. It is interactive and can change.
Definition: OpenLayers is a free tool (a library) that helps you put maps on websites.
Why it is important: It is powerful and works with many kinds of map data.
Simple explanation: Think of OpenLayers as a box of building blocks. Each block helps you add something to your map, like roads or markers.
Real-life example: Many government websites use OpenLayers to show land boundaries.
School example: A geography teacher might use OpenLayers to show a map of rivers in Nigeria.
Home example: You could make a map of your neighbourhood using OpenLayers.
Nigerian example: A tech company in Abuja might use OpenLayers to track delivery bikes.
Illustration:
+----------------------+ | OpenLayers | | [π§±][π§±][π§±] | | Build your map! | +----------------------+
Mini summary: OpenLayers is a library for making web maps. It is free and flexible.
Definition: MapLibre is another free library for making web maps. It is very good at showing smooth, fast maps with vector tiles.
Why it is important: MapLibre makes maps that look modern and load quickly.
Simple explanation: MapLibre is like a sports car. It is fast and stylish. OpenLayers is like a big truck. It can carry many different things.
Real-life example: Some weather apps use MapLibre to show rain moving across the country.
School example: A student project could use MapLibre to show population density in different states.
Home example: You could use MapLibre to make a map of your favourite football pitches.
Nigerian example: A Lagos startup might use MapLibre to show real-time bus locations.
Illustration:
+----------------------+ | MapLibre | | [ποΈ] Zoom! | | Fast and smooth! | +----------------------+
Mini summary: MapLibre is a library for web maps. It is known for speed and modern style.
Definition: Tiles are small square images that fit together like a puzzle to make a big map.
Why it is important: Loading one big map image is slow. Loading small tiles is fast.
Simple explanation: Imagine a giant photo cut into 100 small squares. Your computer only loads the squares you are looking at.
Real-life example: When you zoom into a web map, new tiles appear with more detail.
School example: A jigsaw puzzle is like tiles. Each piece shows a part of the picture.
Home example: A mosaic art piece on your wall is made of small tiles.
Nigerian example: The map of Nigeria is divided into tiles when you view it online.
Illustration:
+----+----+----+ | 1 | 2 | 3 | +----+----+----+ | 4 | 5 | 6 | +----+----+----+ | 7 | 8 | 9 | +----+----+----+ Tiles fit together to make a map.
Mini summary: Tiles are small map pictures. They make web maps fast.
Definition: The view is the part of the map you can see. It has a centre point and a zoom level.
Why it is important: The view tells the map what to show you.
Simple explanation: Think of a camera. The view is what the camera sees. You can point it at different places and zoom in or out.
Real-life example: When you search for βEiffel Towerβ, the view moves to Paris.
School example: The teacher points to a map of Africa. The view is Africa.
Home example: You look out your window. That is your view.
Nigerian example: If you set the view to Lagos, you see Lagos streets.
Illustration:
+---------------------+ | VIEW | | Centre: Lagos | | Zoom: 10 | | [ πΊοΈ ] | +---------------------+
Mini summary: The view controls where the map looks and how close it is.
Definition: A layer is a single sheet of information on the map. You can stack many layers.
Why it is important: Layers let you show roads, rivers, and buildings all at once β or turn them off.
Simple explanation: Imagine tracing paper. You can draw roads on one, rivers on another, and put them on top of each other.
Real-life example: In a car, the GPS shows roads (one layer) and traffic (another layer).
School example: A science project might have a layer for rainfall and a layer for temperature.
Home example: A wedding cake has layers. Each layer adds something new.
Nigerian example: A map of Nigeria might have a layer for states and another for oil pipelines.
Illustration:
+---------------------+ | Layer 3: Shops | +---------------------+ | Layer 2: Roads | +---------------------+ | Layer 1: Land | +---------------------+
Mini summary: Layers are sheets of data. You can add or remove them.
Definition: A source is the place where the map gets its data. It could be a file or a web service.
Why it is important: Without a source, the map has nothing to show.
Simple explanation: If your map is a radio, the source is the radio station. You need a station to hear music.
Real-life example: OpenStreetMap is a free source of map data.
School example: A library is a source of books. A map source is a source of map pictures.
Home example: A tap is a source of water. A map source is a source of map tiles.
Nigerian example: The Nigerian Geological Survey Agency might be a source for rock maps.
Illustration:
+---------------------+
| SOURCE |
| [ποΈ] OpenStreetMap|
| [βοΈ] Satellite |
+---------------------+
|
V
Map gets data
Mini summary: A source gives the map its pictures and information.
Definition: A workspace is the place on your computer where you write your code.
Why it is important: You need a clean, organised place to work.
Simple explanation: Like a carpenter needs a workbench, a coder needs a workspace.
Real-life example: A tailor uses a table to cut fabric. You use a code editor to write code.
School example: Your desk at school is your workspace for writing.
Home example: The kitchen counter is where you prepare food.
Nigerian example: A mechanic in Kano has a workshop. You have a code workshop.
Illustration:
+---------------------+ | WORKSPACE | | [π»] Code Editor | | [π] Project Folder| +---------------------+
Mini summary: Set up a folder and a code editor. That is your workspace.
Definition: We will now write simple HTML to show a map using OpenLayers.
Why it is important: Doing it once makes it less scary.
Simple explanation: We will create an HTML file, add a special link to OpenLayers, and write a few lines to show a map.
Real-life example: Like following a recipe to bake a cake.
School example: Like following steps to solve a maths problem.
Home example: Like assembling a new toy.
Nigerian example: Like following a recipe for jollof rice.
Step-by-step:
index.html.
<!DOCTYPE html>
<html>
<head>
<title>My First OpenLayers Map</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v7.3.0/ol.css">
<style>
#map { width: 100%; height: 400px; }
</style>
</head>
<body>
<h1>My OpenLayers Map</h1>
<div id="map"></div>
<script src="https://cdn.jsdelivr.net/npm/ol@v7.3.0/dist/ol.js"></script>
<script>
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
view: new ol.View({
center: ol.proj.fromLonLat([8.6753, 9.0820]),
zoom: 6
})
});
</script>
</body>
</html>
What the code does: It creates a map in the <div id="map">. It adds a tile layer from OpenStreetMap. It sets the view to Nigeria (longitude 8.6753, latitude 9.0820) with zoom level 6.
Mini summary: You wrote your first OpenLayers map! It shows Nigeria. You can move and zoom.
Definition: Now we do the same with MapLibre.
Why it is important: Comparing both helps you choose the right tool later.
Simple explanation: MapLibre uses a style file to decide how the map looks.
Real-life example: Like choosing a theme for your phone.
School example: Like choosing a colour for your notebook cover.
Home example: Like choosing a wallpaper for your room.
Nigerian example: Like choosing the pattern for your ankara fabric.
Step-by-step:
maplibre.html.
<!DOCTYPE html>
<html>
<head>
<title>My First MapLibre Map</title>
<script src="https://unpkg.com/maplibre-gl@3.0.0/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@3.0.0/dist/maplibre-gl.css" rel="stylesheet">
<style>
body { margin: 0; }
#map { width: 100%; height: 400px; }
</style>
</head>
<body>
<h1>My MapLibre Map</h1>
<div id="map"></div>
<script>
var map = new maplibregl.Map({
container: 'map',
style: 'https://demotiles.maplibre.org/style.json',
center: [8.6753, 9.0820],
zoom: 5
});
</script>
</body>
</html>
What the code does: It creates a MapLibre map. The style URL tells it to use a simple demo style. The centre is Nigeria.
Mini summary: You made a MapLibre map! It also shows Nigeria. Both libraries work.
Definition: We compare the two libraries.
Why it is important: Knowing the differences helps you pick the best one for a project.
Simple explanation: OpenLayers is like a Swiss Army knife β many tools. MapLibre is like a sleek racing bike β fast and modern.
Table: Comparison
| Feature | OpenLayers | MapLibre |
|---|---|---|
| Best for | Many data formats, GIS | Vector tiles, smooth maps |
| Learning curve | Medium | Easy to medium |
| Style | Code-based | JSON style file |
| Speed | Good | Very fast |
| Community | Large | Growing fast |
Mini summary: Both are great. OpenLayers is flexible. MapLibre is fast and modern.
Definition: Here are words you will see often.
Illustration:
Longitude: 8.6753 (left/right)
Latitude: 9.0820 (up/down)
|
V
[π Marker at Abuja]
Mini summary: These words help you talk about maps.
Definition: Maps help solve real problems in Nigeria.
Why it is important: From farming to traffic, maps save time and money.
Simple explanation: A farmer can use a map to see where rain will fall. A driver can use a map to avoid traffic.
Real-life example: During the rainy season, maps show flooded areas in Lagos.
School example: Students can map their schoolβs water points.
Home example: You can map the safest route to your friendβs house.
Nigerian example: The Nigeria Centre for Disease Control uses maps to track diseases.
Illustration:
+---------------------+ | NIGERIA MAP | | [π§οΈ] Flood areas | | [π] Health centres| +---------------------+
Mini summary: Maps are tools for good decisions.
Definition: You have already made two maps!
Why it is important: Reviewing helps you remember.
Simple explanation: Look back at the code you wrote. You used HTML, a library, a source, and a view.
Real-life example: Like finishing a small puzzle.
School example: Like finishing your homework.
Home example: Like cooking your first meal.
Nigerian example: Like learning to make puff-puff for the first time.
Illustration:
Start --> Learn HTML --> Add OpenLayers --> See Map --> Celebrate π
Mini summary: You did it! You are now a beginner web map maker.
| Word | Simple Definition |
|---|---|
| Map | A drawing of a place from above. |
| Web map | A map inside a website that you can move and zoom. |
| OpenLayers | A free tool for making web maps. |
| MapLibre | Another free tool for making web maps, known for speed. |
| Tile | A small square picture that is part of a map. |
| View | The part of the map you see (centre and zoom). |
| Layer | A sheet of information on the map. |
| Source | Where the map gets its data. |
| Longitude | How far left or right a place is. |
| Latitude | How far up or down a place is. |
| Marker | A pin showing a place. |
| GeoJSON | A file that stores map shapes. |
<div> with an id (e.g., βmapβ).new ol.Map.target to your div id.<div> with an id.new maplibregl.Map.container to your div id.style URL (this tells it how to look).center and zoom.
Start
|
V
Create HTML file
|
V
Add library links
|
V
Create map container
|
V
Write map script
|
V
Save and open
|
V
See map! π
1993 - First web map 2005 - Google Maps 2006 - OpenLayers 2010 - OpenStreetMap grows 2020 - MapLibre 2024 - You learn!
| Layer | What it shows |
|---|---|
| Base | Land and water |
| Roads | Streets and highways |
| Buildings | Houses and shops |
| Markers | Special places |
| Question | OpenLayers | MapLibre |
|---|---|---|
| Free? | Yes | Yes |
| Easy to start? | Yes | Yes |
| Best for vector tiles? | Good | Excellent |
| Style method | JavaScript | JSON |
Lesson 1: A map is a drawing of a place from above.
Lesson 2: A web map is an interactive map on a website.
Lesson 3: OpenLayers is a free library for web maps.
Lesson 4: MapLibre is another free library, known for speed.
Lesson 5: Tiles are small map pictures that load fast.
Lesson 6: The view is what you see (centre and zoom).
Lesson 7: Layers are sheets of data you can stack.
Lesson 8: A source is where map data comes from.
Lesson 9: A workspace is where you write code.
Lesson 10: You made your first OpenLayers map.
Lesson 11: You made your first MapLibre map.
Lesson 12: Both libraries are good; they have different strengths.
Lesson 13: You learned map words like longitude and latitude.
Lesson 14: Maps help solve real problems in Nigeria.
Lesson 15: You reviewed and celebrated your progress.
In this module, you learned what maps are, what web maps are, and how to make them with OpenLayers and MapLibre. You set up a workspace, wrote your first two maps, and learned important words like tiles, layers, and sources. You also saw many examples from Nigeria and from everyday life. You are now ready to go deeper.
Match the word to its meaning.
| Word | Meaning |
|---|---|
| 1. Tile | A. Where map data comes from |
| 2. Layer | B. A small square picture |
| 3. Source | C. A sheet of information |
| 4. View | D. What you see (centre and zoom) |
Answers: 1-B, 2-C, 3-A, 4-D
Title: Map Your School
Instructions: In groups of 3, draw a map of your school on paper. Mark the classrooms, the field, and the toilets. Then discuss how you would turn it into a web map. What layers would you use? What markers?
Title: My First Map Code
Instructions: Type the OpenLayers example from Lesson 10 into a file. Change the centre to your city. Save and open. Write down what you see.
Title: A Map of My Favourite Places
Instructions: Create an HTML file with a MapLibre map. Add at least three markers for your favourite places (home, school, shop). Use popups to say why you like each place. Save and show your family.
Task: Write a short paragraph (5 sentences) explaining what you learned in this module. Then, list three things you found easy and one thing you found hard.
In Module Two, we will learn about data sources and layers. We will add more detailed maps, load GeoJSON files, and use different map styles. To get ready, make sure you:
See you in Module Two! π
End of Module One Β· Certified OpenLayers/MapLibre User