Desktop User Guides > Author > Formatting questionnaires > GPS feature > Reporting on location
 
Reporting on location
Example interview script
The LocationReport.mdd example interview script can be used to present GPS data on a map. The project can be activated for use by field managers for reporting on their interviewers.
By default, the LocationReport.mdd example reports only on the GPSQuestion question. The example is in:
[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\
Before the LocationReport.mdd example can be used, get a Google Map API key from:
https://developers.google.com/maps/terms
See the Google Maps API Documentation at:
https://developers.google.com/maps/documentation
Files in the example
The GPS Reporting example is delivered as a package that contains the following files:
DefaultLayout.htm_Files (directory)
DefaultGridTemplate.xml
DefaultLayout.htm
end.png
interview.png
LocationReport.mdd
Map.htm
Map.js
SameLine_Question.htm
start.png
Using the example
To use the example, open the LocationReport.mdd script in a UNICOM Intelligence application (Professional, Author, or the Interviewer Server Launch activity), activate or upload the example files to the server, and start the survey.
The example includes these pages:
Login page
The Login page requests the field manager’s UNICOM Intelligence Interviewer - Server Admin credentials. The credentials filter the project list to only those projects to which the field manager has permission.
Filter page
The Filter page allows the field manager to select a project and to filter the project data. The page displays with a default filter that includes one week of interview data. The default filter also provides the field manager an example date/time format (the date/time is always entered in the interviewer's time zone). The field manager can use the Add Filter button to add an Interviewer ID filter. Additional filters are supported by modifying the LocationReport.mdd interview script.
Map page
The Map page displays the interview coordinates on a map. Each colored line represents an individual interviewer. The interview time is represented by a red triangle (start point) and a red square (end point). The blue person icons represent other interview points. For example:
This graphic is described in the surrounding text.
Functions in the routing script
CreateMap
This function provides a map that includes the GPSQuestion coordinates. The function relies on the GPS question name, GPSQuestion.
The function requires a third-party mapping service. For example, the Google Map API service URL at:
https://maps.googleapis.com/maps/api/js?key=xxx &sensor=false
The URL is referenced in the ShowLocationOnMap.htm file. The client must obtain a Google API key before the file can be run.
CreateReport
This function creates the profile report by using the TOM object. The UpdateLocation function must first be called to populate the GPSQuestion.Location field with the human-readable location that corresponds to the GPS coordinates.
This function is not called in the provided example. The function can be added in order to create a profile report that provides the respondent serial number, interviewer ID, interviewer start time, GPS coordinates, and user-friendly location information.
The provided example must be manually updated when a profile report, instead of a map, is required.
UpdateLocation
This function calls a third-party service to transform the GPS coordinates to a location name. The function depends on a third-party service. For example, the Google Coordinate Service URL is:
http://maps.googleapis.com/maps/api/geocode/xml?latlng=xxx,xxx&sensor=false
The service can be accessed anonymously (with a usage limitation), or by obtaining an API key.
This function is not called in the provided example. The function can be added in order to create a profile report that provides the respondent serial number, interviewer ID, interviewer start time, GPS coordinates, and user-friendly location information.
The provided example must be edited when a profile report, instead of a map, is required.
See also
GPS feature