New data type: Latitude/longitude

New data type: Latitude/longitude

by Dan Stowell -
Number of replies: 15
I've created a data type for Moodle's data activity which specifies a geographic location using latitude/longitude pairs.

It allows for some very interesting features like direct linking to Google Maps and the like.

It's in the contrib CVS here: http://moodle.cvs.sourceforge.net/moodle/contrib/datafield_latlong

Screenshot of simple example attached - capital cities, and the user can jump to see that city in a number of mapping systems.

People often say of new plugins "That should be a core feature of Moodle". In this case I think there might be a good argument for making it core since it's very simple yet powerful, and geographic co-ordinates are used for an awful lot of purposes in teaching. Any thoughts?
Attachment latlong_example2.png
Average of ratings: -
In reply to Dan Stowell

Re: New data type: Latitude/longitude

by N Hansen -
Dan-This looks very useful, but is there a way that the dropdown list could be configured or done away with altogether? The problem with it is that for the places I would want to include, the only thing that would be relevant would be Google Earth, so all I would really need would be the Go button.

However, I would like to see something more than just lat and long. I like being able to make kmz/kml files in GE itself that offer a view from a certain direction, tilt and to be able to add a description, to make a virtual tour of locations etc. You also are going to get better results if you create these things in GE rather than in Moodle because even published coordinates can be off a bit and one needs to see where they are. What I am wondering is if there would be a way to add a field to the database that allows one to attach a kmz or kml created in GE (instead of say, an image), and allow it to be launched.
In reply to N Hansen

Re: New data type: Latitude/longitude

by Richard Treves -
Hi N,

If you want to attach a kmz/kml file to a datapoint then I would just use a database with a file field in which you put .kmz's.  From your posting I think the database just as it is would suffice for you, you can fine tune each file for each location and save them separately.  If you'd like to publish long and lat with each point you can do that with Dan's data type but you could just have lon lat fields anyway, they don't have to be Dan's data type if they don't link anywhere.

Rich
In reply to Richard Treves

Re: New data type: Latitude/longitude

by N Hansen -
Can we have World Wind added to the list of outputs? If you read the Google Earth license you will quickly see that it is pretty restrictive in its commercial use unless you shell out $400 for the pro version. I think having an open source option as an alternative would be better from a legal perspective. I don't think students could get in trouble for using Google Earth, but depending on the institution, the insitution offering the courses could in theory.

Also, how difficult would it be to add more fields besides latitutde and longitude to the kml output file? Again, from a legal perspective, if teachers were to use the database rather than Google Earth to output kml files on the fly, it would probably be legally more acceptable.

In reply to N Hansen

Re: New data type: Latitude/longitude

by Dan Stowell -
The outputs can only be done if there is a way to craft a URL which will jump directly to that lat/long in the other system. Google Earth is a special case in which I've written a script to generate the KML file intermediate, rather than jumping to some online service like multimap.

If you know World Wind (I've never heard of it), can you tell us how best to crosslink to it? Is it an online service with a "URL scheme" for jumping in?
In reply to Dan Stowell

Re: New data type: Latitude/longitude

by N Hansen -
WorldWind is open source software put out by NASA that is similar to Google Earth, except its UI isn't so easy to use but it does have a variety of imagery data particularly useful for scientific research, and since it is US Government/OS there are no licensing/copyright restrictions on the software or the imagery itself. It allegedly can display kmls but while I can get a kml into the program it doesn't seem to want to display for me.
Average of ratings: Useful (1)
In reply to N Hansen

Re: New data type: Latitude/longitude

by Dan Stowell -
That's quite a nice idea, N, about configuring the list. I've updated it so that it's possible to configure which "link-out services" are displayed, if any.

Re your second paragraph, I think Rich's comments are apposite. Use a straightforward "file" field to store KMZ files and you'll be able to do all of that.
In reply to Dan Stowell

Re: New data type: Latitude/longitude

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Fantastic, that should be a core feature in Moodle. smile

Can you add it to HEAD? You have access.
In reply to Martin Dougiamas

Re: New data type: Latitude/longitude

by Dan Stowell -
Good, I'm glad you agree wink Thanks Martin, I'll add it to HEAD, once I've got the I18N sorted.
In reply to Dan Stowell

Re: New data type: Latitude/longitude

by N Hansen -
On a related note, is import of data to the database going to be possible? I've got an Excel table with 12000 coordinates in it that it would be great to be able to import into the database module. Even if I want to hand edit the coordinates I would use in my course myself, having the basic locations in a database for my own use with a launch button would make it a lot easier to create the kmz files because I wouldn't have to cut and paste each coordinate into GE.
In reply to N Hansen

Re: New data type: Latitude/longitude

by Dan Stowell -
No, I'm afraid there's no infrastructure for importing things into the database activity.

If you really want to convert 12000 coordinates from Excel into KMZ, I would recommend you play around with using "Mail Merge" features in Word. It would mean that you'd have to understand the KMZ data format, but once you got a grip on it, you could create a mail merge that would create a nice big KMZ file containing all your co-ordinates.
In reply to Dan Stowell

Re: New data type: Latitude/longitude

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You can import ... look down the bottom of the "add" screen ...
In reply to Martin Dougiamas

Re: New data type: Latitude/longitude

by Dan Stowell -
Ah, I see, it can import CSV. That's handy.

So for a datatype like this, which has two separate values, does the import work nicely? I assume you've solved a similar problem for the "URL" field (which has two elements, URL and Title). Can the CSV infrastructure do this?
In reply to Dan Stowell

Latitude/longitude data type now in HEAD

by Dan Stowell -
This new data type is now in Moodle HEAD CVS, meaning it'll be part of Moodle 1.7.

It now works quite nicely with Google Earth. When you jump over to Google Earth, the placemark carries a link which allows you to jump right back to the Moodle data item you're looking at. Attached is a screenshot, in which I've made an entry for Moodle HQ, and clicked through to Google Earth. On the left you can see the link which will take me back to Moodle.

A couple of unsolved things which would improve the interface slightly: (1) It would be nice to be able to use one of the other data fields as the title to appear in GE rather than "Item #3"; (2) It's possible to export the whole set of items to GE (you just need to know the URL to use), but the data activity infrastructure doesn't offer any good point at which to offer a "send all items to Google Earth" link.
Attachment moodle-earth.png
In reply to Dan Stowell

Re: Latitude/longitude data type now in HEAD

by Dan Stowell -
P.S. I've now solved those two unsolved items wink
In reply to Dan Stowell

Re: Latitude/longitude data type now in HEAD

by Jim Proctor -
Dan et al. -- This thread is a bit old, but given your statement several months ago that you fixed the unsolved items I'm curious whether the lat/long field allows you to export more than one record to e.g. Google Earth? MoodleDocs only says "When viewing the record, links are automatically generated linking to geographic data services" and does not mention the possibility of sending multiple lat/longs to e.g. Google Earth. The potential utility is tremendous: one executes a search, then maps all returned records (e.g., in Google Earth, as a folder of placemarks). Indeed, without this multi-record capability the lat/long feature would be rather limited, though fun.

Thanks...we are upping to 1.7 soon here but this could be critical to some of my database activities --

Jim