The enviroCar Team recently built a new platform for managing transportation data in the form of “tracks”. A simple but extensible JSON encoding supports the quick prototyping approach within the architecture of the data server, Android app for data collection, and PHP-based website for visualization and social interaction. As the project matures, we encounter new requirements. One of these is to enable users to download the track data in formats that simplify data import to other tools, such as mapping software (e.g. ArcGIS) or tabular analysis software (e.g. Excel spreadsheets), so that scientists and citizens alike can derive new findings and develop new information products based on the enviroCar data.
No sooner said than done, we developed and now publicly release two new export formats, shapefile and CSV! Both download formats are available via the API. To try it out, simply take any track URL and append “.shp” or “.csv” to download the track in a specific format. Examples:
Alternatively, you can use HTTP headers in your code to request a specific format.
The process is a little bit easier for your own tracks. The “Download” menu in the single track view was extended to include the new formats.
The shapefile format, while not an open standard, is very widespread. Both open source and proprietary GIS software have good support for importing and exporting it. The name, however, is misleading since “a shapefile” can consist of several files containing metadata, geometries, and attribute data. As a result, the enviroCar API provides shapefiles in a zipped format (see screenshot of the folder contents below).
After the files are imported into any GIS software, the geospatial analysis can begin. The following screenshot shows an enviroCar track in ESRI ArcMap (click image for a larger version).
The “character-separated values” – format stores tabular data in simple text files and is a de-facto standard. It can be read by almost any other software or you can easily write a parser in any programming language. The screen shot below (click image for larger version) shows the data imported into Microsoft Excel using the “Data” -> “From Text” function.
In the R environment for statistics computing and graphics, the following two lines suffice to download and import enviroCar CSV data and display a plot which contrasts selected measurement variables (click image for larger version).
track = read.csv2("https://envirocar.org/api/stable/tracks/53433169e4b09d7b34fa824a.csv")
plot(subset(track, select = c("Consumption.l.h.", "Speed.km.h.", "Rpm.u.min.")))
Leave a Reply