This worksheet describes how to add the respondent’s location to a Snap Mobile Anywhere or a Snap WebHost survey. It assumes that the survey will run on a GPS-enabled phone or tablet (Global Positioning System).

It also includes an example of extracting valid location data for analysis.

Background

Capturing the location is only useful if you are creating a survey for a Snap WebHost edition that is likely to be seen on a mobile device, or a mobile survey for Snap Mobile Anywhere. The survey must be running on a device which can capture geolocation information, (such as a GPS-enabled tablet).

Location data is only available in Snap WebHost and Snap Mobile Anywhere editions. It’s stored in the ID.location variable in WGS84 (World Geodetic System) format. You can extract the separate elements of the location data by using the system patterns provided. The worksheet includes two examples showing you how to do this. You can also export the data for external analysis.

Issues with capturing locations

The two main methods of getting a location are using GPS or using information from mobile phone masts. GPS is more accurate but uses more battery power, so people may disable it.

You have no control over whether people permit the survey to use geolocation information, or whether their device is able to provide accurate geolocation information. For example, if people are looking at surveys with a PC, the location provided may be that of a router.

When running the survey, the geolocation can only be stored if the device has the means and the browser or Snap Mobile Anywhere has the permission to capture location data.

It’s best if you know what device your survey is running on, for example, if the survey is carried out by interviewers using Snap Mobile Anywhere.

Summary of steps

Step 1: Enable geolocation in your survey

  1. Go to an appropriate edition (Snap WebHost or Snap Mobile Anywhere) of your survey.
  2. Click questionnaire properties icon to display the QuestionnaireProperties dialog box.
  3. Scroll down the options on the left to find the Paradata section.
  4. Highlight the Geolocation field and check the box marked Use in survey.
    par_geoloc_hl
  5. Press [OK] to return to the questionnaire.The ID.location variable will appear below the title. This is the name of the variable Snap uses to store the geolocation.loc_quest
  6. Select it, and select the Show toolbar option.
  7. Select All in the next dropdown list and clear the Show box. The ID.location variable will be hidden.

    sh_loc_hid

  8. Click save to save the changes to the questionnaire.

Step 2: Configure how accurate the data is

It is possible to change the settings to make the device spend a longer or shorter time looking for the location if the defaults are not adequate.

  1. Click q_prop to display the QuestionnaireProperties dialog box.
  2. Scroll down the options on the left to find the Paradata section.
    par_geoloc_conf_hl
  3. Highlight the Geolocation field and click [Configure] to open the Configure Geolocation dialog
    geoloc_conf
  4. Set Timeout to how long (in seconds) that you want the device to keep searching for a location. The longer it searches the more battery it uses.
  5. Set Target accuracy to the precision that you would like to try and achieve. This is only a guide as the device may not be able to be this accurate.
  6. Press [OK] to return to the questionnaire.

Step 3: Publish the survey and prepare it for interviewers

You must now publish the survey and upload it to Snap WebHost. This is described in the section Upload the published survey to Snap WebHost in the Getting Started guide. If the survey is for Snap Mobile Anywhere you must also assign it to interviewers. This is described in the worksheet: Setting up surveys for Snap Mobile Anywhere

Example of extracting the data for analysis

The most common method of using geolocation data is to export the data and use it with a mapping API, such as google maps (see https://developers.google.com/maps/) or Open Street Map (see http://wiki.openstreetmap.org/wiki/API).

You can export the data directly in WGS84 format or create derived variables to hold the data in a specified format.

To export the data:

  1. Select Data Entry window button to the Data Entry window.
  2. Select File | Export to display the Data Export dialog.

    dat_exp_csv_loc

  3. Set the Format.
  4. Select File as the destination and enter an appropriate filename.
  5. Enter the name of the variable(s) to export in the Content field. The example shows ID.location.

Modifying the data using a derived variable

Extract the longitude and latitude to a single derived literal variable.

This example tests to see if an error has been received, so only valid geolocations are stored. It then stores the latitude and the longitude, separated by a comma. It assumes that you have added the paradata ID.location to your survey.

  1. Create a new derived variable
  2. Specify the Variable Details:

    Name: LatLong

    Label: Latitude and Longitude

    Type: Derived (the variable will derive its data from other existing variables).

    Response: Literal

    NA: unless ((ID.location as geo unavailable) == "")

    Values: ID.location as geo latitude:", ":ID.location as geo longitude

    der_lat_lon

    The : is a literal operator in Snap. It allows you to put different values together

  3. Click save to save the variable.

Conclusion

This worksheet has described how to add the geolocation variable to your survey and export the collected data. It has explained some of the issues with collecting location data. It has also provided an example of cleaning the data to remove errors.

For further information about patterns in Snap, see: Introduction to patterns.

For a full list of the system patterns available, see: System patterns.

For more information about surveys on mobile devices see Getting Started with Snap Mobile Anywhere and the worksheet Setting up surveys for Snap Mobile Anywhere.

If there is a topic you would like a worksheet on, email to snapideas@snapsurveys.com