Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Map API

From MoodleDocs
New Map API
Project state Proposal/Development in progress
Tracker issue MDL-42522
Discussion https://moodle.org/mod/forum/discuss.php?d=245569
Assignee {{{assignee}}}

Moodle 2.7 This page is for collecting feature requests for a possible new API to enable easy use of geographical maps.

Current status

Moodle + contrib has three separate map implementations:

  1. The built-in map in the IP address lookup (under /iplookup)
  2. block_online_users_map is a contrib module that shows recent users plotted on a world map.
  3. block_simple_map is a contrib module that allows users to search for places specified by a CSV upload
  • Additionally, the Database activity has a latlong field, which outputs as links to external mapping services.

High-level proposal

A core module to provide an easy way to add maps and mapping features:

  1. Display a map with specified size, location, zoom, and tileset.
  2. Display one or more markers on the map.
  3. Display popups (or other display methods) with additional information when a user clicks on markers.
  4. Geocoding (i.e. find lat/long from location name - should adopt existing iplookup solution).
  5. Input of locations by clicking on the map.
  6. Reverse geocoding (i.e. find location name from lat/long).

Existing work (2013-12-10)

An alpha level implementation is done, including all proposed features except integration of the existing geocoding system.

Map API (local module)

  • The Leaflet javascript map library as a YUI module.†
  • A PHP class to easily: Add maps, display markers and popups, input locations, perform reverse geocoding.

Demonstration at: http://dbtest.conted.ox.ac.uk/moodlemaps/local/map

† There are other map libs, e.g.:

  • OpenLayers - older, larger, with more features than I think we need here.
  • Modest Maps - fairly minimal, with fewer
  • Polymap - looks interesting for data mapping, but not sure how useful that would be in Moodle.

...however, I'm most familiar with Leaflet and feel it hits the right features/weight balance (e.g. includes geoJSON, but avoids complications with projections), so think it's the right place to start.

Database activity submodules

  1. A modification/fork of the latlong field to enable maps for display and input
  2. A new preset (named "Infomap") to utilise the modified latlong field.

Demonstration at: http://dbtest.conted.ox.ac.uk/moodlemaps/course/view.php?id=2

Plugins

The local and database modules have been formatted into three modules:

Feedback on the plugins (or the Git branch linked in MDL-42522) would be appreciated.

Detailed propsal

TBC