This is part 1 of a series of blog posts on the design and implementation of the location-aware Windows Store app "Location Data Logger". Download the source code to Location Data Logger here.
What is a Data Logger?
Before descending into the details of the development of Location Data Logger, I want to spend some time on what, exactly, a data logger application is and why it's useful.
The concept originates with GPS receivers, whether they be consumer, commercial, or military grade, and the idea that you can record a log of your position and movement over time. Consumer receivers refer to this as a track log, which consists of a series of track points that records the device's position (including altitude), heading, speed, and the time at some pre-defined interval. Depending on the receiver other information might be logged as well, such as data from supplemental sensors like air pressure and compass heading. The result is a precise position log that can be reviewed, analyzed, and processed at a later time.
A hiker, for example, can save a track of his or her hike and then review it at home to determine the total mileage walked, total elevation gain, as well as plot the hike on a map. That track log can be exported to a data file and shared with others so that future hikers might benefit from the information. Such track logs function as rudimentary trail maps, giving other potential hikers valuable information about the location of trailheads and the route of the trails themselves, which is very useful when local maps are either incomplete or of questionable quality. At the commercial level, track logs are regularly used to ground-truth trails, roads, and other geographic features that are difficult to spot on or trace from aerial imagery and thus may not be accurately mapped.
Other uses include creating logs of vehicle travel, such as by delivery and transportation companies to monitor the efficiency of routing, and by insurance companies to monitor driver habits (with the driver's permission, of course). Track logs are immensely useful, and dedicated GPS receivers with small form factors and minimal user interfaces, known as data loggers, are readily available in the market.
Location Data Logger turns your Windows 8 device into a data logger.
Requirements for the Location Data Logger app
Given the above, the list of requirements for a data logger app is mercifully short and simple. At minimum, the app must:
- Track position
- Start and stop logging
- Record position logs to a data file
As I said, that is a very short list. Practically speaking, however, the app needs to offer a bit more than this to provide a decent user experience, so I'll expand it to:
- Track position
- Start and stop logging
- Record position logs to one or more commonly-accepted data file formats
- Per-session logging
- Stay active while logging
- Filter by estimated accuracy
The first two should be fairly obvious, but the last four probably require some explanation.
Recording to common-accepted file formats
A key function of a data logger is the ability to export and share the track logs, and that means choosing a file format that is accepted by other applications. In the GPS world, there are several standards for exchanging data points and Location Data Logger supports the three that are arguably the most common and most useful. They are:
- CSV. The comma-separated value format is versatile because it does not have a fixed schema. Data is simply written out into a flat file that resembles a table, with one row of comma-separated values per data line.
- GPX. The GPS Exchange format is an XML-based data format designed specifically for interchanging GPS data. It is an open standard first released in 2002 and has undergone some minor revisions since that time. GPX is widely supported by GIS systems and data converters.
- KML. The Keyhole Markup Language is a newer XML-based format and also an open standard. Unlike GPX, KML files are not limited to just GPS logging, and can be used to describe arbitrary geographic elements such as points of interest/waypoints, lines, polygons, networks, overlays, and more, with styling information for each. Entire maps can be defined using just KML elements.
These three file formats are almost universally supported by Geographic Information Systems, mapping applications, and GPS data converters. In Location Data Logger, the user can choose to log to one or more of these three formats simultaneously, allowing greatest flexibility in sharing their track logs.
This feature is a matter of log file hygiene. When the user starts the data logger, a new log file is created. When they stop the logger, the log file is closed. This allows users to separate their track logs into different files. Location Data Logger goes a step further in automatically naming log files by date and time so that the user does not have to be prompted, and it eliminates log file collisions (in the event that the user starts and stops the logger rapidly, unique filenames are generated to guarantee this).
Staying active while logging
It would be undesirable for the logger to be interrupted in middle of an active session since the point of running a data logger is to log every data point. This means keeping Windows from going to sleep, suspending the app, or taking any other action might cause the app to stop running. Of course, this means that the data logger will consumer quite a bit of power, but that's the nature of this sort of application: you trade power savings for necessary functionality.
Filtering by estimated accuracy
The geolocation sensor in Windows 8 is not a single sensor but rather a collection of location inputs from multiple sources. The device's position can come from an IP address, Wi-Fi triangulation, or a high-precisions source such as a Global Navigation Satellite System (e.g., GPS). More than likely, the user is most interested in position data coming from the latter, but rather than force this on them Location Data Logger gives the user a choice: one can filter out "low precision" data, meaning position reports that are not regularly coming from a high-precision source such as GPS. This filtering will be discussed in a future installment of this series.
In addition to the base requirements, I added two features to Location Data Logger to improve the overall user experience.
Location Data Logger displays the user's current position on a map provided by the Bing mapping service along with an accuracy circle calculated from the estimated horizontal accuracy. While the online map does require an active internet connection to update, it is not a necessary component and the data logger will function without it (albeit without live maps). This gives the user something to look at and review during operation.
The user can bring up a tabular view of the track points logged to the current log files. This allows a review of the track points directly and in a user-friendly manner, without having to open up the log files in a separate text viewer.
Next: User interface design
In Part 2, I'll discuss the design of the user interface.
|← Introduction||Part 2: User Interface →|