Details

      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/

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            salvetore 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
            salvetore 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
            balchd 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
            balchd 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
            balchd David Balch added a comment - - edited

            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
            balchd David Balch added a comment - - edited 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=13 Any feedback would be appreciated.
            Hide
            salvetore 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
            salvetore 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
            balchd 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
            balchd 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
            balchd 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
            balchd 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
            Hide
            gtielemans Ger Tielemans added a comment - - edited

            David,
            I like your idea of embedding maps in the database module. It is very rich and inspiring!

            Do you have the database example in the demo also available in a zip? (you do more interting things then just use the plugins )

            Show
            gtielemans Ger Tielemans added a comment - - edited David, I like your idea of embedding maps in the database module. It is very rich and inspiring! Do you have the database example in the demo also available in a zip? (you do more interting things then just use the plugins )
            Hide
            balchd David Balch added a comment -

            Hi Ger, thanks for your interest!

            I recently prepared a version of Moodle 2.7 with my map functionality, and pushed it to GitHub, here: https://github.com/Dave-B/moodle/tree/M27_maps

            There's a "Download ZIP" button on that page, at the bottom of the right-side column - you should be able to download and install that like a regular version of Moodle.

            Once it's running, add a Database activity to the course and use the "Infomap" preset.

            Do let me know any feed back you have

            Show
            balchd David Balch added a comment - Hi Ger, thanks for your interest! I recently prepared a version of Moodle 2.7 with my map functionality, and pushed it to GitHub, here: https://github.com/Dave-B/moodle/tree/M27_maps There's a "Download ZIP" button on that page, at the bottom of the right-side column - you should be able to download and install that like a regular version of Moodle. Once it's running, add a Database activity to the course and use the "Infomap" preset. Do let me know any feed back you have
            Hide
            gtielemans Ger Tielemans added a comment - - edited

            Ok, m27_maps up and running.
            I create a database-maps and choose infomap as presets
            I see the presets in the templates
            I add a location

            Now I compare with your demo:
            If I choose view single: no map
            if I choose view list: map yes, tags no
            (must I add a google key or so?)

            >>> update: I found it: switch "use maps" on in localisation, now I see the tags

            By the way, what is the function of more?

            Still like the idea
            =======================================================
            Wished functionality:

            1.In the overview map you expect that the map zooms-in
            when the tags are all in a specific area

            =======================================================

            2. already there: with the search function you can analyse the clustering of tghe data in the map

            Show
            gtielemans Ger Tielemans added a comment - - edited Ok, m27_maps up and running. I create a database-maps and choose infomap as presets I see the presets in the templates I add a location Now I compare with your demo: If I choose view single: no map if I choose view list: map yes, tags no (must I add a google key or so?) >>> update: I found it: switch "use maps" on in localisation, now I see the tags By the way, what is the function of more? Still like the idea ======================================================= Wished functionality: 1.In the overview map you expect that the map zooms-in when the tags are all in a specific area ======================================================= 2. already there: with the search function you can analyse the clustering of tghe data in the map
            Hide
            balchd David Balch added a comment -

            Oops - sorry, I forgot about the "Use maps" option!

            Yes, the showing and hiding of the information panels (and the data table) is done with CSS - but importantly it also needs javascript.
            (NB: Use of javascript for key functionality used to be frowned upon due to accessibility problems, but it's possible to make JS accessible - although this code probably needs a lot of work).

            > By the way, what is the function of more?
            I'm not sure what you're referring to.

            > Wished functionality: with advanced search or so?
            There is a search feature built-in to the database (underneath the map) that I think does what you describe. I'd like to add searching by location, but that would depend on enough of the right people being interested.

            Show
            balchd David Balch added a comment - Oops - sorry, I forgot about the "Use maps" option! Yes, the showing and hiding of the information panels (and the data table) is done with CSS - but importantly it also needs javascript. (NB: Use of javascript for key functionality used to be frowned upon due to accessibility problems, but it's possible to make JS accessible - although this code probably needs a lot of work). > By the way, what is the function of more? I'm not sure what you're referring to. > Wished functionality: with advanced search or so? There is a search feature built-in to the database (underneath the map) that I think does what you describe. I'd like to add searching by location, but that would depend on enough of the right people being interested.
            Hide
            gtielemans Ger Tielemans added a comment -

            Yes, search is good enough.. (wished only the auto zoom after a search filtering)

            search by location... you mean filtering items if they are in the neigbourhoud of a central needle you plant? (distance to that needle)

            the function of the magnifying glass

            Show
            gtielemans Ger Tielemans added a comment - Yes, search is good enough.. (wished only the auto zoom after a search filtering) search by location... you mean filtering items if they are in the neigbourhoud of a central needle you plant? (distance to that needle) the function of the magnifying glass
            Hide
            gtielemans Ger Tielemans added a comment - - edited

            Works also fine under 2.6.3+ (Build: 20140619)

            I see here only two presets:

            What is the difference beween infomap and infomap(plugin version)?

            Show
            gtielemans Ger Tielemans added a comment - - edited Works also fine under 2.6.3+ (Build: 20140619) I see here only two presets: What is the difference beween infomap and infomap(plugin version)?
            Hide
            balchd David Balch added a comment -

            > In the overview map you expect that the map zooms-in when the tags are all in a specific area
            Yeah, I'd like to add that as well but - again - it depends on enough of the right people being interested.

            > What is the difference beween infomap and infomap(plugin version)?
            There's no functional difference; one uses code added directly to Moodle, the other uses code added as Moodle plugins.

            I'm currently reorganising my Git development setup to make managing and upstreaming changes easier, and getting my group's customisations ready and tested for upgrading to 2.7 in September.

            Once that's done I hope to tidy this up a bit and get it in a state where at least the key parts could be integrated into Moodle. I might be able to add some features, but - as the basics are working - I don't think much is likely to happen this year.

            If you wanted to try and add the features you suggest I'd be happy to integrate improvements! (http://docs.moodle.org/dev/Developer_documentation is a good place to start if you don't know how).

            If you're not ready to do development, no worries - it just might take a while for those new features to appear

            NB: All the edits made to your comments send out emails - it would be good if you could proof-read your comments before adding them, so anyone CC'd on the issue doesn't get spammed with typo corrections - thanks!

            Show
            balchd David Balch added a comment - > In the overview map you expect that the map zooms-in when the tags are all in a specific area Yeah, I'd like to add that as well but - again - it depends on enough of the right people being interested. > What is the difference beween infomap and infomap(plugin version)? There's no functional difference; one uses code added directly to Moodle, the other uses code added as Moodle plugins. I'm currently reorganising my Git development setup to make managing and upstreaming changes easier, and getting my group's customisations ready and tested for upgrading to 2.7 in September. Once that's done I hope to tidy this up a bit and get it in a state where at least the key parts could be integrated into Moodle. I might be able to add some features, but - as the basics are working - I don't think much is likely to happen this year. If you wanted to try and add the features you suggest I'd be happy to integrate improvements! ( http://docs.moodle.org/dev/Developer_documentation is a good place to start if you don't know how). If you're not ready to do development, no worries - it just might take a while for those new features to appear NB: All the edits made to your comments send out emails - it would be good if you could proof-read your comments before adding them, so anyone CC'd on the issue doesn't get spammed with typo corrections - thanks!

              People

              • Votes:
                6 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: