Details

    • Rank:
      54337

      Description

      Currently Moodle has a map feature for IP address lookup (under /iplookup), but there are additional places that maps could be useful, so having shared map functions would be a good idea:

      • Contrib plugins already exist for showing online users on a map [0], searching for places specified by a CSV upload [1], but they use their own map code.
      • I'm developing a Database activity enhancement to display LatLong fields on maps [2].
      • I don't know if it's important, but MDLSITE-2478 could use a shared map. I imagine others could think of some interesting ways of using it as well.

      I've a proof of concept up at [3].

      At this point I'm wondering whether MoodleHQ would accepted something like this into core, so it's available for iplookup, my Database patches (or a new field), and any other plugins.

      Key components:

      • Make the Leaflet javascript map library [4] available as a YUI module.†
      • Use OSM maps
      • Ammend core settings (replacing/augmenting googlemapkey3):
        • enable/disable JS maps
      • Helper functions to add maps to pages, and plot markers/vectors/popups on them.
      • Maps for inputting geo data
      • Provide a non-javascript fallback (like iplookup)

      † 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.

      Possible future features:

      • Add/ammend core settings to:
        • Choose map provider (e.g. OSM, Google, Cloudmade, etc.)
      • Geocoding
      • Reverse geocoding

      What's the best way for me to proceed?

      [0] https://moodle.org/plugins/view.php?plugin=block_online_users_map
      [1] https://moodle.org/plugins/view.php?plugin=block_simple_map
      [2] https://moodle.org/mod/forum/discuss.php?d=241006
      [3] http://dbtest.conted.ox.ac.uk/moodlemaps/
      [4] http://leafletjs.com/

        Activity

        Hide
        Michael de Raadt added a comment -

        Hi, David.

        There was a Map module in the old Modules and Plugins DB (https://moodle.org/mod/data/view.php?d=13&rid=1745&filter=1), but it doesn't look like anyone has updated that. If someone was willing to resurrect that, we wouldn't add a new module to core Moodle. What do you think?

        Your idea of an enhancement to the Database module sounds good.

        Show
        Michael de Raadt added a comment - Hi, David. There was a Map module in the old Modules and Plugins DB ( https://moodle.org/mod/data/view.php?d=13&rid=1745&filter=1 ), but it doesn't look like anyone has updated that. If someone was willing to resurrect that, we wouldn't add a new module to core Moodle. What do you think? Your idea of an enhancement to the Database module sounds good.
        Hide
        David Balch added a comment -

        Hi Michael,

        Yeah I had looked at that old map module, and think my Database enhancement should provide equivalent functionality - hopefully with more flexibility due to using Database.

        If it were just that single activity which used maps then I can see there wouldn't be a need for anything in core, but there are at least four (iplookup, my Database tweaks, the two blocks) features with maps, which could potentially use the same code. Then again, I suppose the number of sites with multiple of these is not going to be massive.

        I guess for the moment I'll see if I can do it as a plugin and make the enhancements without having to make any changes to Database core.

        Show
        David Balch added a comment - Hi Michael, Yeah I had looked at that old map module, and think my Database enhancement should provide equivalent functionality - hopefully with more flexibility due to using Database. If it were just that single activity which used maps then I can see there wouldn't be a need for anything in core, but there are at least four (iplookup, my Database tweaks, the two blocks) features with maps, which could potentially use the same code. Then again, I suppose the number of sites with multiple of these is not going to be massive. I guess for the moment I'll see if I can do it as a plugin and make the enhancements without having to make any changes to Database core.
        Hide
        David Balch added a comment -

        Hi,

        This isn't at pull request stage as it needs some tidying but it's working pretty well, with code available at: https://github.com/Dave-B/moodle/tree/master-maps

        Briefly, this includes:

        • Leaflet.js in a YUI module, with a couple of helper functions.
        • PHP classes for constructing and showing a map with specified view, tiles, and markers.

        Any feedback would be appreciated.

        Show
        David Balch added a comment - Hi, This isn't at pull request stage as it needs some tidying but it's working pretty well, with code available at: https://github.com/Dave-B/moodle/tree/master-maps Briefly, this includes: Leaflet.js in a YUI module, with a couple of helper functions. PHP classes for constructing and showing a map with specified view, tiles, and markers. Map demo page at http://dbtest.conted.ox.ac.uk/moodlemaps/local/map/ Example Database http://dbtest.conted.ox.ac.uk/moodlemaps/mod/data/view.php?id=11 Any feedback would be appreciated.
        Hide
        Michael de Raadt added a comment -

        That looks great. I had a go on your test server.

        Perhaps the next step is to submit your code to the Plugins Directory. There's no category for Database Activity fields, so yours would be the first.

        Show
        Michael de Raadt added a comment - That looks great. I had a go on your test server. Perhaps the next step is to submit your code to the Plugins Directory. There's no category for Database Activity fields, so yours would be the first.
        Hide
        David Balch added a comment -

        Thanks.

        I've now started making it into plugins, but wanted to get the github link up first, as the plugin approach will be a bit convoluted; It'll need a local plugin for the maps, the latlong modifications (which I'll provide as a new field plugin), and a preset.

        I'll post an update when they're available...

        Show
        David Balch added a comment - Thanks. I've now started making it into plugins, but wanted to get the github link up first, as the plugin approach will be a bit convoluted; It'll need a local plugin for the maps, the latlong modifications (which I'll provide as a new field plugin), and a preset. I'll post an update when they're available...
        Hide
        David Balch added a comment -

        I've created plugins for this, for anyone who doesn't get on with GitHub. I think it's easier to use GitHub, as there are three plugins required:

        That said, making the plugins was a useful exercise, as it made me do more testing and make more improvements

        Show
        David Balch added a comment - I've created plugins for this, for anyone who doesn't get on with GitHub. I think it's easier to use GitHub, as there are three plugins required: local_map - the API. datafield_latlongmap - a modified latlong field. datapreset_infomap_latlongmap - a preset using datafield_latlongmap. That said, making the plugins was a useful exercise, as it made me do more testing and make more improvements

          People

          • Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated: