Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Saving GPS coordinates

Saving GPS coordinates 1 Jahr 3 Monate her #95003

  • marcic
  • marcics Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 6
  • Karma: 1
Hi there,

I was wondering if Limesurvey can save GPS coordinates obtained after clicking a link with a Javascript? I can get the coordinates to show in a Text display type of question but could not manage to get the two lines to be saved.

Maybe some of you are aware of a workaround available.

attached see lss file with one group and question with the script

Best,

Marcis
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Saving GPS coordinates 1 Jahr 3 Monate her #95008

  • orvil
  • orvils Avatar
  • OFFLINE
  • Expert Lime
  • Beiträge: 104
  • Dank erhalten: 4
  • Karma: 4
Hi,

use an equation type question to read the text field (with EM). The result of the equation will be stored.
And: may be it is possible to poke your data directly to an equation type question.
Best regards/Beste Grüße,
O. Villani
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Saving GPS coordinates 1 Jahr 3 Monate her #95019

  • marcic
  • marcics Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 6
  • Karma: 1
Thanks for your reply but apparently my skills with javascript are too weak and I cannot implement your propsed solution.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Saving GPS coordinates 1 Jahr 3 Monate her #95025

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4071
  • Dank erhalten: 748
  • Karma: 341
Please attach your sample survey.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Saving GPS coordinates 1 Jahr 3 Monate her #95026

  • marcic
  • marcics Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 6
  • Karma: 1
Sorry, apparently the lss file was not attached. Here it is again.



What I was trying to do was to implement one of these solutions:

macmost.com/iphone-gps-location-with-javascript.html

merged.ca/iphone/html5-geolocation
Letzte Änderung: 1 Jahr 3 Monate her von marcic. Begründung: no file attached
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Saving GPS coordinates 1 Jahr 3 Monate her #95031

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4071
  • Dank erhalten: 748
  • Karma: 341
Still no file attached but here's an example using your first link in a short-text question.

Add this to the question source (I used a button element to fire the geolocation function):
<button class="gpsLink" type="button">Get GPS Data</button>
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function(){
 
		// Identify this question
		var q1ID = '{QID}';
		var q1 = $('#question'+q1ID);
 
		// Click event for the button
		$('.gpsLink').click(function(){
			getGPS();
		});
 
		function getGPS() {
			if (navigator.geolocation) {  
				navigator.geolocation.getCurrentPosition(showGPS, gpsError);
			} else {  
				$('input.text', q1).val('No GPS Functionality');  
			}
		}
 
		function gpsError(error) {
			alert('GPS Error: '+error.code+', '+error.message);
		}
 
		function showGPS(position) {
			$('input.text', q1).val(position.coords.latitude+', '+position.coords.longitude);
		}
 
	});
</script>

Here's a test survey:

Dateianhang:

Dateiname: limesurvey_survey_geolocation.lss
Dateigröße: 12 KB
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: marcic

Saving GPS coordinates 1 Jahr 3 Monate her #95052

  • marcic
  • marcics Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 6
  • Karma: 1
Excellent! works as I imagined how it should work. Perhaps this could be added to workarounds?

Thanks,

Marcis
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Saving GPS coordinates 1 Jahr 3 Monate her #95053

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4071
  • Dank erhalten: 748
  • Karma: 341
Sure, we could add it but I'm hesitant given that it won't work in IE 7-8.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.143 Sekunden
Donation Image