Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
← Certified OpenLayers/MapLibre User Β· Lesson 5 of 6

Interaction and Map Controls – Making Your Map Respond

πŸ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
5
Module Four Β· Certified OpenLayers/MapLibre User

πŸ“˜ Module Four: Interaction and Map Controls – Making Your Map Respond

🌟 Module Introduction

Welcome back, map maker! In Module One, you learned how to put a basic map on a web page. In Module Two, you learned how to add data sources and layers. In Module Three, you learned how to style your map to make it beautiful and smart.

But there is still something missing. Right now, your map is like a painting. You can look at it, but you cannot talk to it. You cannot click on a school to see its name. You cannot draw a shape on the map. You cannot ask the map to take you to a specific place.

That is where interaction and map controls come in. Interaction means the map responds to what you do. You click, and something happens. You hover, and something appears. Map controls are the buttons and tools that help you use the map. Zoom buttons, a scale bar, a fullscreen button – these are all controls.

In this module, you will learn how to make your map come alive. You will learn how to add click events, popups, and selection tools. You will learn how to add zoom controls, a scale line, and a geolocation button. By the end, your map will not just be a picture. It will be a tool that people can use.

We will keep using simple words and lots of examples. Let’s make your map talk!

🎯 Learning Objectives

After you finish this module, you will be able to:

  • Explain what map interaction means.
  • Add click events to a map.
  • Create popups that appear when you click a feature.
  • Use the Select interaction in OpenLayers.
  • Add built-in controls like zoom, scale, and fullscreen.
  • Add a geolocation button to find the user’s location.
  • Use the Draw interaction to draw points, lines, and polygons.
  • Use the Modify interaction to change shapes.
  • Understand hover effects and mouse movements.
  • Avoid common mistakes with interactions.
  • Feel confident to build a fully interactive map.

πŸ“– Warm-up Story: Emeka and the Talking Map

Emeka lived in Port Harcourt. He loved building things. One day, he made a map of his neighbourhood using OpenLayers. It showed all the shops, schools, and churches. His friends looked at it and said, β€œThis is nice, but what does each building do? We cannot tell.”

Emeka thought about it. He wanted his map to talk. So he added a special feature. When you click on a shop, a small box appears saying, β€œThis is Mama Nkechi’s shop. She sells the best puff-puff in town.” When you click on a school, it says, β€œThis is Sunshine Primary School. It has 500 students.”

His friends were amazed. β€œIt is like the map is talking to us!” they said. Emeka smiled. He had learned about popups and click events. His map was no longer silent. It was interactive.

Moral of the story: A map that responds to clicks is a map that people love to use.

πŸ“š Main Lessons

Lesson 1: What is Map Interaction?

Definition: Map interaction is when the map responds to something you do. You click, drag, hover, or scroll, and the map reacts.

Why it is important: Interaction makes a map useful. Without it, a map is just a picture.

Simple explanation: Think of a video game. When you press a button, the character moves. That is interaction. A map can do the same.

Real-life example: When you tap a restaurant on Google Maps, a box appears with its name and rating. That is interaction.

School example: A school map where you click a classroom to see the teacher’s name.

Home example: A family map where you click a photo to see a memory.

Nigerian example: A map of Lagos where you click a bus stop to see the next bus time.

Illustration:

  You click on a point
         |
         V
  +---------------------+
  |  Popup appears!     |
  |  "This is a school" |
  +---------------------+
  

Mini summary: Interaction means the map responds to you. Clicking, hovering, and dragging are all interactions.

Lesson 2: Click Events – When You Click, Something Happens

Definition: A click event is code that runs when you click on the map.

Why it is important: Click events are the foundation of interactivity. They let you respond to the user.

Simple explanation: You tell the map: β€œWhen someone clicks here, do this.”

Real-life example: When you click a location in a ride-hailing app, it shows the fare.

School example: A school map where clicking a building shows its name.

Home example: A family map where clicking a house shows who lives there.

Nigerian example: A map of Abuja where clicking a government building shows its name.

Example code in OpenLayers:

  map.on('click', function(event) {
    console.log('You clicked at: ' + event.coordinate);
  });
  

Example code in MapLibre:

  map.on('click', function(e) {
    console.log('You clicked at: ' + e.lngLat);
  });
  

Illustration:

  Click! --> Event fires --> Code runs --> Something happens
  

Mini summary: Click events let you run code when the user clicks. They are the first step to interactivity.

Lesson 3: Popups – Small Boxes with Information

Definition: A popup is a small box that appears on the map. It usually shows information about a place.

Why it is important: Popups give details without cluttering the map. They appear only when needed.

Simple explanation: When you click a marker, a little speech bubble appears. That is a popup.

Real-life example: When you click a hotel on a travel website, a popup shows the price and rating.

School example: A school map where clicking a classroom shows the subject taught there.

Home example: A family map where clicking a house shows a photo of the family.

Nigerian example: A map of Kano where clicking a market shows what goods are sold there.

Illustration:

     ● Marker
    /
  +---------------------+
  |  Popup              |
  |  "Kano Market"      |
  |  "Sells fabric"     |
  +---------------------+
  

Mini summary: Popups are small boxes that show information. They appear when you click.

Lesson 4: Creating Popups in OpenLayers

Definition: In OpenLayers, you create a popup using an Overlay.

Why it is important: Overlays let you place HTML elements on the map.

Simple explanation: You create a div in your HTML. Then you tell OpenLayers to show it at a certain location.

Real-life example: A real estate website shows house details in a popup.

School example: A school map shows room numbers in popups.

Home example: A family map shows recipes in popups.

Nigerian example: A map of Lagos shows traffic reports in popups.

Example code:

  var popup = new ol.Overlay({
    element: document.getElementById('popup'),
    positioning: 'bottom-center'
  });
  map.addOverlay(popup);
  map.on('click', function(event) {
    popup.setPosition(event.coordinate);
  });
  

Illustration:

  Overlay
     |
     V
  +---------------------+
  |  HTML div           |
  |  Position: clicked  |
  +---------------------+
  

Mini summary: In OpenLayers, popups are made with Overlays. You control the HTML and the position.

Lesson 5: Creating Popups in MapLibre

Definition: MapLibre has a built-in Popup class. It is very easy to use.

Why it is important: MapLibre popups are simple and look modern.

Simple explanation: You create a popup, set its text, and tell it where to appear.

Real-life example: A weather app shows temperature in a popup.

School example: A school map shows the number of students in a popup.

Home example: A family map shows birthdays in a popup.

Nigerian example: A map of Nigeria shows state capitals in popups.

Example code:

  var popup = new maplibregl.Popup()
    .setLngLat([8.6753, 9.0820])
    .setHTML('<h3>Abuja</h3><p>Capital of Nigeria</p>')
    .addTo(map);
  

Illustration:

  new Popup()
     |
     V
  setLngLat()
     |
     V
  setHTML()
     |
     V
  addTo(map)
  

Mini summary: MapLibre has a simple Popup class. You set the location and the HTML.

Lesson 6: The Select Interaction in OpenLayers

Definition: Select is an OpenLayers interaction that lets you click on a feature to select it.

Why it is important: Selection lets you highlight features and show their details.

Simple explanation: When you click a point, it changes colour to show it is selected.

Real-life example: In a map of houses, you click a house and it highlights in yellow.

School example: A school map where you click a classroom and it lights up.

Home example: A family map where you click a house and it shows a photo.

Nigerian example: A map of Lagos where you click a bus stop and it shows the route.

Example code:

  var select = new ol.interaction.Select();
  map.addInteraction(select);
  select.on('select', function(e) {
    console.log('Selected: ' + e.selected.length);
  });
  

Illustration:

  Click a point
       |
       V
  +---------------------+
  |  Point highlights   |
  |  Selected!          |
  +---------------------+
  

Mini summary: The Select interaction lets you click and highlight features. It is built into OpenLayers.

Lesson 7: Built-in Controls – Zoom, Scale, and More

Definition: Controls are buttons and tools that help you use the map. Zoom buttons, scale bars, and fullscreen buttons are controls.

Why it is important: Controls make the map easier to use. They are like the buttons on a TV remote.

Simple explanation: You add controls to the map, and they appear in a corner.

Real-life example: Google Maps has a zoom control in the bottom right corner.

School example: A school map with a scale bar to show distance.

Home example: A family map with a fullscreen button to see more.

Nigerian example: A map of Nigeria with a geolocation button to find your position.

Example code in OpenLayers:

  map.addControl(new ol.control.Zoom());
  map.addControl(new ol.control.ScaleLine());
  map.addControl(new ol.control.FullScreen());
  

Example code in MapLibre:

  map.addControl(new maplibregl.NavigationControl());
  map.addControl(new maplibregl.ScaleControl());
  map.addControl(new maplibregl.FullscreenControl());
  

Illustration:

  +---------------------+
  |  Map                |
  |  [+] Zoom           |
  |  [βˆ’] Zoom           |
  |  [β›Ά] Fullscreen     |
  |  [πŸ“] Scale         |
  +---------------------+
  

Mini summary: Controls are buttons that help you use the map. You can add them easily.

Lesson 8: Geolocation – Finding the User’s Location

Definition: Geolocation is finding where the user is on the map.

Why it is important: It helps users see where they are and get directions.

Simple explanation: You click a button, and the map shows a blue dot where you are.

Real-life example: When you open a maps app, it shows your location.

School example: A school map that shows where you are standing.

Home example: A family map that shows where each family member is.

Nigerian example: A map of Lagos that shows your position in traffic.

Example code in OpenLayers:

  map.addControl(new ol.control.Geolocation({
    tracking: true,
    projection: 'EPSG:4326'
  }));
  

Example code in MapLibre:

  map.addControl(new maplibregl.GeolocateControl({
    positionOptions: { enableHighAccuracy: true },
    trackUserLocation: true
  }));
  

Illustration:

  Click geolocation button
         |
         V
  +---------------------+
  |  Blue dot appears   |
  |  "You are here"     |
  +---------------------+
  

Mini summary: Geolocation finds the user’s location. It is a very useful control.

Lesson 9: The Draw Interaction – Drawing on the Map

Definition: Draw is an OpenLayers interaction that lets you draw points, lines, and polygons on the map.

Why it is important: Drawing lets users add their own data. It is great for planning and marking areas.

Simple explanation: You click on the map to start drawing. You click again to finish.

Real-life example: A farmer draws the boundary of his farm on a map.

School example: A student draws the route from home to school.

Home example: You draw a plan of your dream house.

Nigerian example: A town planner draws the boundary of a new market.

Example code:

  var draw = new ol.interaction.Draw({
    source: vectorSource,
    type: 'Polygon'
  });
  map.addInteraction(draw);
  

Illustration:

  Click -> Click -> Click -> Double-click
     |       |       |          |
     V       V       V          V
  Start   Line    Line      Polygon
  

Mini summary: The Draw interaction lets you draw shapes on the map. You can draw points, lines, and polygons.

Lesson 10: The Modify Interaction – Changing Shapes

Definition: Modify is an OpenLayers interaction that lets you change the shape of a drawn feature.

Why it is important: Sometimes you make a mistake. Modify lets you fix it.

Simple explanation: You click a shape, and small dots appear at its corners. You drag a dot to change the shape.

Real-life example: A farmer adjusts the boundary of his farm.

School example: A student changes the route of a planned trip.

Home example: You change the shape of your dream house plan.

Nigerian example: A planner adjusts the boundary of a new road.

Example code:

  var modify = new ol.interaction.Modify({
    source: vectorSource
  });
  map.addInteraction(modify);
  

Illustration:

  Original shape:     Modified shape:
  +--------+          +----------+
  |        |          |          |
  |        |   --->   |          |
  |        |          |          |
  +--------+          +----------+
  

Mini summary: The Modify interaction lets you change shapes. You drag the corner points.

Lesson 11: Hover Effects – When the Mouse Moves

Definition: A hover effect happens when you move the mouse over something without clicking.

Why it is important: Hover effects give feedback. They tell you that something is clickable.

Simple explanation: When you move your mouse over a button, it changes colour. That is a hover effect.

Real-life example: On a website, a link changes colour when you hover over it.

School example: A school map where hovering over a classroom shows a tooltip.

Home example: A family map where hovering over a photo shows a caption.

Nigerian example: A map of Nigeria where hovering over a state shows its name.

Example code in OpenLayers:

  map.on('pointermove', function(event) {
    var feature = map.forEachFeatureAtPixel(event.pixel, function(f) {
      return f;
    });
    if (feature) {
      console.log('Hovering over: ' + feature.get('name'));
    }
  });
  

Illustration:

  Mouse moves over point
         |
         V
  +---------------------+
  |  Tooltip appears    |
  |  "School"           |
  +---------------------+
  

Mini summary: Hover effects happen when you move the mouse. They give feedback without clicking.

Lesson 12: Adding a Scale Line and Attribution

Definition: A scale line shows the distance on the map. Attribution gives credit to the data source.

Why it is important: The scale line helps you understand distance. Attribution is honest and respectful.

Simple explanation: The scale line is like a ruler on the map. Attribution is a small text that says where the data came from.

Real-life example: A hiking map shows a scale line so you know how far you will walk.

School example: A school map with a scale line to show the length of the football field.

Home example: A family map with a scale line to show the distance to the market.

Nigerian example: A map of Lagos with a scale line to show the distance from Ikeja to Victoria Island.

Example code in OpenLayers:

  map.addControl(new ol.control.ScaleLine());
  map.addControl(new ol.control.Attribution({
    collapsible: false
  }));
  

Illustration:

  +---------------------+
  |  Map                |
  |  [====] 10 km       |
  |  Β© OpenStreetMap    |
  +---------------------+
  

Mini summary: The scale line shows distance. Attribution gives credit. Both are important.

Lesson 13: Touch and Mobile Interactions

Definition: Touch interactions are how you use a map on a phone or tablet. You tap, pinch, and swipe.

Why it is important: Many people use maps on their phones. Your map must work on touch screens.

Simple explanation: Instead of clicking, you tap. Instead of scrolling, you swipe. Instead of zooming with buttons, you pinch.

Real-life example: When you use Google Maps on your phone, you pinch to zoom.

School example: A student uses a tablet to explore a school map.

Home example: Your parents use their phones to find directions.

Nigerian example: A taxi driver uses a phone map to navigate Lagos traffic.

Illustration:

  Tap:     πŸ‘† (click)
  Pinch:   🀏 (zoom)
  Swipe:   πŸ‘‰ (pan)
  Double-tap: πŸ‘†πŸ‘† (zoom in)
  

Mini summary: Touch interactions are important for phones. Tap, pinch, and swipe.

Lesson 14: Combining Interactions – A Fully Interactive Map

Definition: You can combine many interactions on one map.

Why it is important: Real maps use many interactions together.

Simple explanation: You can click to select, hover to see names, draw new shapes, and modify them. All on one map.

Real-life example: A city planning tool lets you select buildings, draw new roads, and modify boundaries.

School example: A school map where you can click classrooms, hover for teacher names, and draw new paths.

Home example: A family map where you can click houses, hover for names, and draw routes.

Nigerian example: A map of Abuja where you can select government buildings, hover for names, and draw new bus routes.

Illustration:

  +---------------------+
  |  Interactions:      |
  |  [πŸ‘†] Click         |
  |  [πŸ–±οΈ] Hover         |
  |  [✏️] Draw          |
  |  [βœ‚οΈ] Modify        |
  +---------------------+
  

Mini summary: Combining interactions makes your map powerful. Users can do many things.

Lesson 15: Testing Your Interactive Map

Definition: Testing means trying your map to make sure it works.

Why it is important: You do not want your users to find bugs. You want to find them first.

Simple explanation: Click everything. Hover over everything. Try to break it. Then fix it.

Real-life example: Before a new app is released, testers try every button.

School example: Before a school play, students practise the whole play.

Home example: Before you serve food, you taste it.

Nigerian example: Before a new bus route starts, the drivers test the road.

Illustration:

  Build map
      |
      V
  Test click
      |
      V
  Test hover
      |
      V
  Test draw
      |
      V
  Fix bugs
      |
      V
  Celebrate πŸŽ‰
  

Mini summary: Always test your map. Click, hover, draw, and modify. Fix any problems.

πŸ“– Key Vocabulary

WordSimple Definition
InteractionWhen the map responds to you.
Click eventCode that runs when you click.
PopupA small box with information.
OverlayAn HTML element placed on the map.
SelectAn interaction that highlights a feature.
ControlA button or tool on the map.
GeolocationFinding the user’s location.
DrawAn interaction to draw shapes.
ModifyAn interaction to change shapes.
HoverMoving the mouse over something.
Scale lineA ruler on the map.
AttributionCredit to the data source.

πŸ”‘ Important Concepts

  • Interaction makes maps useful: Click, hover, draw, and modify.
  • Popups show details: They appear when you click.
  • Controls help users: Zoom, scale, fullscreen, geolocation.
  • Select highlights features: It shows what you clicked.
  • Draw and Modify add editing: Users can create and change shapes.
  • Touch is important: Maps must work on phones.
  • Always test: Find bugs before your users do.

🧭 Step-by-Step Explanations

How to add a popup in OpenLayers

  1. Create a div in your HTML with an id (e.g., β€œpopup”).
  2. Create an Overlay: new ol.Overlay({ element: document.getElementById('popup') }).
  3. Add the overlay to the map: map.addOverlay(popup).
  4. Listen for clicks: map.on('click', function(event) { ... }).
  5. Set the popup position: popup.setPosition(event.coordinate).
  6. Set the popup content: document.getElementById('popup').innerHTML = 'Hello!'.

How to add a control in MapLibre

  1. Create the control: new maplibregl.NavigationControl().
  2. Add it to the map: map.addControl(control).
  3. Optionally, set the position: map.addControl(control, 'top-right').

🌍 Real-life Examples

  • Google Maps: click a place for details.
  • Uber: see cars moving and tap for fare.
  • Weather apps: hover for temperature.
  • City planning tools: draw new roads.
  • Hiking apps: use scale line for distance.

πŸ‡³πŸ‡¬ Nigerian Examples

  • A map of Lagos where clicking a bus stop shows the next bus.
  • A map of Abuja where clicking a government building shows its name.
  • A map of Kano where hovering over a market shows what is sold.
  • A map of Port Harcourt where drawing a polygon marks a new estate.
  • A map of Nigeria where a scale line shows the distance from Lagos to Abuja.

🎈 Fun Examples Children Can Relate To

  • A treasure map where clicking an X shows a riddle.
  • A map of your school where clicking the cafeteria shows the menu.
  • A map of your house where hovering over your room shows your name.
  • A map of your favourite game world where you can draw paths.
  • A map of your neighbourhood where you can mark your friends’ houses.

🏠 Everyday Examples

  • Clicking a restaurant to see its menu.
  • Hovering over a bus stop to see the route.
  • Using a scale line to measure distance.
  • Using geolocation to find your way.
  • Drawing a route to school.

πŸ‘¨β€πŸ‘©β€πŸ‘§ Parent Tips

  • Encourage your child to test their map on different devices.
  • Ask them to explain what happens when you click a feature.
  • Help them add a popup to a family map.
  • Celebrate when they make their first interactive map.
  • Remind them that testing is part of building.

πŸ’‘ Interesting Facts

  • The first interactive web map appeared in 1993.
  • Google Maps introduced draggable maps in 2005.
  • Touch interactions became popular with the iPhone in 2007.
  • OpenLayers has over 20 built-in interactions.
  • MapLibre popups can contain images and buttons.

πŸ€” Did You Know?

  • Did you know that you can draw on a map with your finger on a phone?
  • Did you know that popups can contain videos?
  • Did you know that geolocation uses GPS, Wi-Fi, and cell towers?
  • Did you know that you can select multiple features at once?
  • Did you know that hover effects can show a tooltip?

πŸ“Œ Remember This

  • Interaction means the map responds to you.
  • Click events run code when you click.
  • Popups show information in a small box.
  • Controls are buttons that help you use the map.
  • Geolocation finds your location.
  • Draw lets you add shapes.
  • Modify lets you change shapes.
  • Hover gives feedback without clicking.
  • Always test your map on different devices.

⚠️ Common Mistakes

  • Forgetting to add the overlay to the map.
  • Using the wrong coordinate order (longitude, latitude).
  • Not setting a height for the popup div.
  • Forgetting to remove the draw interaction after drawing.
  • Not testing on touch screens.

βœ… Best Practices

  • Always give feedback when a user clicks.
  • Use popups to show details, not to clutter the map.
  • Add a scale line for distance.
  • Include attribution for data sources.
  • Test on both desktop and mobile.
  • Remove draw and modify interactions when not needed.

πŸ“Š Illustrations, Diagrams, and Tables

Flowchart: Adding Interactivity to a Map

  Start
    |
    V
  Add click event
    |
    V
  Create popup
    |
    V
  Add controls
    |
    V
  Add draw interaction
    |
    V
  Test everything
    |
    V
  Celebrate πŸŽ‰
  

Timeline: History of Map Interaction

  1993 - First interactive web map
  2005 - Google Maps draggable
  2006 - OpenLayers released
  2007 - iPhone touch maps
  2010 - Geolocation on maps
  2015 - Vector tiles enable smooth interaction
  2020 - MapLibre
  2024 - You build interactive maps!
  

Table: Common Controls in OpenLayers and MapLibre

ControlOpenLayersMapLibre
Zoomol.control.ZoomNavigationControl
Scaleol.control.ScaleLineScaleControl
Fullscreenol.control.FullScreenFullscreenControl
Geolocationol.control.GeolocationGeolocateControl
Attributionol.control.AttributionAttributionControl

Comparison Table: Interactions in OpenLayers vs MapLibre

InteractionOpenLayersMapLibre
Clickmap.on('click')map.on('click')
Hovermap.on('pointermove')map.on('mousemove')
Selectol.interaction.SelectCustom (via click)
Drawol.interaction.DrawCustom (via plugin)
Modifyol.interaction.ModifyCustom (via plugin)

πŸ“ Summary After Every Lesson

Lesson 1: Interaction means the map responds to you.

Lesson 2: Click events run code when you click.

Lesson 3: Popups are small boxes with information.

Lesson 4: In OpenLayers, popups use Overlays.

Lesson 5: In MapLibre, popups use the Popup class.

Lesson 6: Select highlights features when clicked.

Lesson 7: Controls are buttons like zoom and scale.

Lesson 8: Geolocation finds the user’s location.

Lesson 9: Draw lets you draw points, lines, and polygons.

Lesson 10: Modify lets you change shapes.

Lesson 11: Hover effects give feedback without clicking.

Lesson 12: Scale lines show distance. Attribution gives credit.

Lesson 13: Touch interactions are important for phones.

Lesson 14: Combining interactions makes a powerful map.

Lesson 15: Always test your map before sharing it.

πŸ“¦ End-of-Module Summary

In this module, you learned how to make your map interactive. You discovered click events and popups. You learned how to use the Select interaction, add controls like zoom and scale, and use geolocation. You explored the Draw and Modify interactions, which let users add and change shapes. You also learned about hover effects, touch interactions, and the importance of testing. Your map is no longer a silent picture. It is a tool that responds to the user. You are now a map builder!

❓ Frequently Asked Questions (10 questions)

  1. What is interaction? When the map responds to you.
  2. What is a click event? Code that runs when you click.
  3. What is a popup? A small box with information.
  4. How do I create a popup in OpenLayers? Using an Overlay.
  5. How do I create a popup in MapLibre? Using the Popup class.
  6. What is the Select interaction? It highlights features when clicked.
  7. What is geolocation? Finding the user’s location.
  8. What is the Draw interaction? It lets you draw shapes.
  9. What is the Modify interaction? It lets you change shapes.
  10. Why should I test my map? To find and fix problems before users see them.

πŸ”— Matching Exercises

Match the word to its meaning.

WordMeaning
1. PopupA. Finding the user’s location
2. GeolocationB. A small box with information
3. DrawC. A button or tool on the map
4. ControlD. Drawing shapes on the map
5. HoverE. Moving the mouse over something

Answers: 1-B, 2-A, 3-D, 4-C, 5-E

🧩 Scenario-based Exercises

  1. You want to show a school’s name when clicked. What do you use? (Popup)
  2. You want to find your location on a map. What do you use? (Geolocation)
  3. You want to mark the boundary of a farm. What do you use? (Draw)
  4. You want to change the shape of a drawn boundary. What do you use? (Modify)
  5. You want to show distance on a map. What do you add? (Scale line)

πŸ‘₯ Group Activity

Title: Build an Interactive Map of Your School

Instructions: In groups of 3, create a map of your school with at least five points (classrooms, library, cafeteria, field, office). Add popups that show what each place is. Add a zoom control and a scale line. Present to the class.

πŸ§‘ Individual Activity

Title: My First Popup

Instructions: Create a map with one point. Add a popup that shows your name and your favourite place. Save and show your family.

πŸ› οΈ Mini Project

Title: A Fully Interactive Map of My Neighbourhood

Instructions: Create an HTML file with a map. Add at least five points of interest (home, school, shop, church, park). Add popups with details for each. Add a zoom control, a scale line, and a geolocation button. Add a draw interaction so users can draw a route. Test on a phone and a computer. Present to the class.

πŸ“‹ Practical Assignment

Task: Write a short paragraph (5 sentences) explaining what you learned about map interaction and controls. Then, list three things you found easy and one thing you found hard.

πŸ”‘ Key Takeaways

  • Interaction makes a map useful.
  • Click events run code when you click.
  • Popups show information in a small box.
  • Controls help users zoom, scale, and find location.
  • Draw and Modify let users add and change shapes.
  • Hover effects give feedback.
  • Touch interactions are important for phones.
  • Always test your map on different devices.
  • Combining interactions makes a powerful map.

πŸ’¬ Classroom Discussion Questions

  1. Why is interaction important in a map?
  2. What is the difference between a click and a hover?
  3. How can popups help someone using a map?
  4. What controls would you add to a map of your school?
  5. How can drawing on a map be useful?

➑️ Preparation for the Next Module

In Module Five, we will learn about project integration and deployment. We will put our maps into real websites using React or Vue. We will learn how to build and deploy our maps so the whole world can see them. To get ready, make sure you:

  • Have a fully interactive map with popups and controls.
  • Know how to test on different devices.
  • Remember how to add interactions and controls.
  • Practice adding a draw interaction to a map.

See you in Module Five! πŸš€


End of Module Four Β· Certified OpenLayers/MapLibre User

πŸ† Get Certified

πŸ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (₦2,000 or 20,000 coins), and get a verified certificate with your name on it.

πŸŽ“ Sign Up to Get Certified
πŸ› οΈ Practice Tools
Hands-on simulators & labs - subscription required.
β†’
🎯 Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
β†’