Welcome to the LimeSurvey Community Forum

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

Saving GPS coordinates

More
8 years 2 weeks ago #134489 by first
Replied by first on topic Saving GPS coordinates
I guess most of you already know but just for who don't..

Location from web browser:
#Gives the coordinates of the nearest Internet server respondent is connected to when survey start.
#Respondent will get a prompt in his browser which he has to confirm only then location will get captured.
#This approach will work even if device do not have GPS like laptop / desktop etc.

Location GPS(eg In Mazi offline application ):
#Capture coordinate using mobile GPS system.
#Highly precise
#No internet connectivity required.

It is very frequent requirement CAPI survys to capture GPS location the moment Interview starts. Clients wants it to confirm that interviewers and doing genuine interview.

Survey Designer and Programmer
The topic has been locked.
More
7 years 8 months ago #140862 by mounabelaid
Replied by mounabelaid on topic Saving GPS coordinates
Hello
Would you tell where should I put exactly this script in LimeSurvey?
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
7 years 8 months ago #141009 by Mazi
Replied by Mazi on topic Saving GPS coordinates

mounabelaid wrote: Hello
Would you tell where should I put exactly this script in LimeSurvey?


If you are talking about the OfflineSurveys GPS location tracking feature, that is pretty simple to set up:
  1. Go to www.offlinesurveys.com/add-android-multimedia-question
  2. Download the "GPS location tracking" question/LSQ file from there.
  3. Import the LSQ file at your survey (this can be done when creating a new question)
  4. Activate the survey and cache the survey for offline usage
That survey should now include the GPS location tracking feature.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
7 years 7 months ago #141895 by mana
Replied by mana on topic Saving GPS coordinates
hi
this code don't work in the app
i need code like this for location position . (in offline survey )
thanks
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 7 months ago #141905 by tpartner
Replied by tpartner on topic Saving GPS coordinates
This is not a forum for OfflineSurveys support. Please contact them directly.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
7 years 7 months ago #141907 by Mazi
Replied by Mazi on topic Saving GPS coordinates

mana wrote: this code don't work in the app


"Doesn't work" is not an appropriate error description.
- Are there any error messages?
- Which Limesurvey version do you use?
- Which OfflineSurveys version do you use?
- Did you edit the downloaded question? I just tested it and it worked fine for my at the OfflineSurveys app.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
5 years 8 months ago #172306 by tpervaiz
Replied by tpervaiz on topic Saving GPS coordinates
I used this code which is working perfectly in survey however the coordinates are not showing in response or survey report..Is there anything else I have to do?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 8 months ago #172310 by tpartner
Replied by tpartner on topic Saving GPS coordinates
What LimeSurvey version are you using?

Can you attach an export (.lss) of a small sample survey?

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
5 years 8 months ago #172313 by tpervaiz
Replied by tpervaiz on topic Saving GPS coordinates
the version is Version 3.14.2+180807

I am able to get GPS coordinates in both ways Automatically as well as Push button but the problem is the coordinates are not showing in responses and reports

Please see the lss in attachment

Thanks in advance
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 8 months ago #172314 by tpartner
Replied by tpartner on topic Saving GPS coordinates
Try this for the respective scripts:

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',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');
        $('input:hidden[id^="answer"]', 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);
      $('input:hidden[id^="answer"]', q1).val(position.coords.latitude+';'+position.coords.longitude);
    }
 
    getGPS();
 
  });
</script>

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',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');
        $('input:hidden[id^="answer"]', 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);
      $('input:hidden[id^="answer"]', q1).val(position.coords.latitude+';'+position.coords.longitude);
    }
 
  });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...2762.lss
File Size:19 KB

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, tpervaiz, DavidPausDD
The topic has been locked.
More
5 years 8 months ago #172315 by tpervaiz
Replied by tpervaiz on topic Saving GPS coordinates
GPS coordinates are not even showing in survey itself by using the script provided by you

Do I need more workaround?
The topic has been locked.
More
5 years 8 months ago #172316 by tpervaiz
Replied by tpervaiz on topic Saving GPS coordinates
Its working now,, I copied half script

Thanks alottttt
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose