Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Saving GPS coordinates

  • marcic
  • marcic's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 1 week ago #95052 by marcic
Replied by marcic on topic Saving GPS coordinates
Excellent! works as I imagined how it should work. Perhaps this could be added to workarounds?

Thanks,

Marcis
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 years 1 week ago #95053 by tpartner
Replied by tpartner on topic Saving GPS coordinates
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.
The topic has been locked.
More
9 years 1 month ago #118147 by dgtano
Replied by dgtano on topic Saving GPS coordinates
Hello. Thank you very much for your contribution.
I would automatically save the GPS coordinates, without the button. Is it possible?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #118196 by tpartner
Replied by tpartner on topic Saving GPS coordinates
This will fire the getGPS() function when the page is loaded.

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).ready(function(){
 
    // Identify this question
    var q1ID = '{QID}';
    var q1 = $('#question'+q1ID);
 
    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);
    }
 
    getGPS();
 
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
9 years 1 month ago #118197 by dgtano
Replied by dgtano on topic Saving GPS coordinates
Fantastic. Tks a lot
The topic has been locked.
More
9 years 1 month ago - 9 years 1 month ago #118541 by shawnchan
Replied by shawnchan on topic Saving GPS coordinates
Hello,

Thank you very much for your effort, it looks like everybody else can work it out with your sample survey. I also tried to do it with your sample survey [limesurvey_survey_geolocation.lss ], but nothing shows in the text box after clicking the button, although a pop-up window shows up and asking for permission to get the location. Do you have any idea on this? I can get the location in Google map so I guess it's not the signal problem.

I also tried it on both android device and IPAD but it's still not working.

Thanks a lot.

LimeSurvey: Version 1.91+ Build 11379
Last edit: 9 years 1 month ago by shawnchan.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #118554 by tpartner
Replied by tpartner on topic Saving GPS coordinates
The survey was developed for LS 2+. Please upgrade your installation.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
9 years 1 month ago #118555 by shawnchan
Replied by shawnchan on topic Saving GPS coordinates
Thanks for you reply. Is there any way I can get the GPS coordinates without an upgrade?

I tried to copy the two functions getGPS and showGPS to the lss file by the version 1.91 and then import back to LS but no luck..is there any way you can help to modify the lss file attached? It would be great if the lime survey can automatically save the GPS coordinates and store the coordinates as a variable.

I am attaching a sample survey generated by limesurvey Version 1.91+ Build 11379.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #118557 by tpartner
Replied by tpartner on topic Saving GPS coordinates
I'm sorry, I cannot develop or test for 1.92 - it's too old.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • holch
  • holch's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #118564 by holch
Replied by holch on topic Saving GPS coordinates
@tpartner: And it is not even 1.92, it is 1.91, even older...

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
9 years 1 month ago #118589 by shawnchan
Replied by shawnchan on topic Saving GPS coordinates
Oh..I guess I have to upgrade Limesurvey before asking for help again.

Thanks again for your advise.
The topic has been locked.
More
9 years 2 weeks ago #118976 by shawnchan
Replied by shawnchan on topic Saving GPS coordinates
I used your scripts on demo version of limesurvey and I can get the GPS coordinates now. The GPS coordinates is automatically shown the text box when I open the survey. Thanks tpartner for that.

What I'm trying to do now is to use the GPS function as a measure of quality control, making sure that they have done the interviews at the correct location.

Is there any way we can "secretly" store the GPS coordinates without noticing the users? because now GPS coordinates is shown on screen and even can be edited by users. I tried to do it by hiding the questions but I can't get the GPS coordinates when the question is hidden.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose