Mode of Course Delivery

  1. Lectures
  2. Online tutorials
  3. Practical(s)
  4. Assignment(s)
  5. Presentation(s)

Course Outline

  1. Introduction: Definition, world wide web (www) & web cartography
  2. Designing web services and web maps using Leaflet & Google Maps API
  3. Reading Data from various Data source
  4. Web mapping techniques; web design & development, hyperlinking, animations, web atlas, multimedia mapping
  5. Construction & publishing Geospatial information using HTML, GML
  6. Web mapping libraries and frameworks
  7. In this course; Leaflet & Google Maps API

Course Outcomes

  1. Understand the basics of client-server architecture
  2. Understand the basics of client side technologies [HTML, CSS, JavaScript]
  3. Understand the basics of server-side technologies [PHP, SQL, Databases]
  4. Client and Server Communication - AJAX
  5. Libraries and frameworks - JQuery
  6. Tools for geospatial applications - [Leaflet, Google Maps, Turf, PostGIS, GeoJSON]

Lecture 1: Introduction to Web Mapping

Web Programming

J Mwaura

Required knowledge

HTML & CSS syntax

  • w3schools.com
  • w3resources.com

Basic JavaScript programming skills

Map service; WMS, WMTS &am; TMS

QGIS or ArcGIS


Make Google your friend

Evolution of Web Technologies

HTML, CSS & JS

HTML - allows us to structure content for our web page. Our map will be contained in an element within an HTML file

CSS - gives us control of the style and visual presentation of our web page. We will use it in the placement and sizing of the map and to customize some Leaflet elements

JavaScript - gives us the ability to add interactivity to our web page. We will use it to pull in map tiles to our web page, add data (or content layers), and handle user interaction with the map

Services & JavaScript Libraries

Google Map - Google Inc

Leaflet - CloudMade

Openlayers - OpenStreetMap

Bing Maps, Here Maps, ArcGIS Online, MapBox.

Library Comparison

Name Open Source ? Free ? Limitations
Google Maps No Daily Licence
Leaflet Yes Yes skills & time
Here Maps No Monthly Licence
ArcGIS Online No No Licence
Openlayers Yes Yes skills & time
Bing Maps No Monthly Licence
MapBox (Yes) Monthly Licence

Commercial Services

Registration needed You get an API key

  • Identifies your application
  • Used to monitor the usage of your service
  • Reference the key in your JavaScript files

1. Google Maps

2. ArcGIS Online

Choose base maps

Add your own data & styles

Publish/share your map as an application

  1. Application templates available
  2. Available at GitHub

Edit the application with JavaScript API

3. MapBox

Design maps with the MapBox Studio

Reference your design by id in your JavaScript file

Vector tiles

Based on OpenSource APIs

4. Openlayers

5. Leaflet

Simple & lightweight (it is only 28kb of code)

Mobile friendly

Simple API

Not many features included

Easier to learn if you don't know JavaScript well

Which library to choose?

Base maps

User interface & layout

Interactive map features

You should have some kind of interactivity in your map

Easy-to-use API for event handling etc

Filtering with a slider: jQuery + noUiSlider

Handling coordinates

It's best to transform your data points to the same CRS as your base map in QGIS/ArcGIS

If you need CRS transformations in your JavaScript code, use proj4js


Click proj4js

Debugging

Use browser tools

JavaScript code console.log(variable)

Spatial Data Formats

  1. File-based data
    • Shapefile, KML, GeoJSON, & TopoJSON, gpx, csv
  2. Spatially-enabled database data
    • Proprietary: Microsoft SQL Server, Oracle Spatial, & the Esri ArcSDE middleware
    • Open equivalents: PostgreSQL with PostGIS extension, SQLite with SpatiaLite extension
  3. Raster formats
    • Open raster formats JPEG, PNG, TIFF, BMP, GIF

Spatial File Structures: Shapefile

Spatial File Structures: KML

Spatial File Structures: GeoJSON

Spatial File Structures: TopoJSON

In Summary

End of Lecture 1

Web Programming

That's it!

Queries about this Lesson, please send them to: jmwaura@jkuat.ac.ke

*References*

  • Google Maps; Power Tools for Maximizing the API, 2014 Evangelos Petroutsos
  • D3 Tips and Tricks; Interactive Data Visualization in a Web Browser, 2013 Malcolm Maclean
  • Interactive Data Visualization for the Web, 2013 Scott Murray
  • Web Programming with HTML5, CSS, and JavaScript, 2019 John Dean
  • Leaflet Documentation Leaflet Team
  • Google Documentation for developers Google Team
Courtesy of
Web Programming