Desktop User Guides > Professional > Interview scripting > Writing interview scripts > GPS feature > Reporting on location
 
Reporting on location
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 installed to:
[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\
Before using the example
Before the LocationReport.mdd example can be used, you must obtain a Google Map API key from the following Google site:
https://developers.google.com/maps/terms
Refer to the Google Maps API Documentation at:
https://developers.google.com/maps/documentation/
Files in the example
The GPS Reporting example is in this folder:
C:\Program Files\Common Files\IBM\SPSS\DataCollection\7\DDL\
Scripts\Interview\Utilities\LocationReport
It contains these 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 an 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 three pages:
1 Login page: The Login page requests the field manager’s UNICOM Intelligence Interviewer - Server credentials. The credentials filter the project list to only those projects to which the field manager has permission.
2 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.
3 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.
Routing script functions
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 via 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 will need to 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 (see Obtaining a Google 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 will need to be changed when a profile report, instead of a map, is required.
See also
GPS feature