Class strymmap

Import strymmap as:

from strym import strymmap

for reading and analysing GPS csv files gathered with comma.ai Black or Grey Panda.

class strym.strymmap(csvfile, **kwargs)

strymmap reads the GPS data from the given CSV file. This class provides several utilities functions to work with GPS Data

Parameters
csvfie : str

The CSV file to be read

csvfile

The filepath of CSV Data file

Type

string

dataframe

Pandas dataframe that stores content of csvfile as dataframe

Type

pandas.Dataframe

aq_time

Acquisition Time of GPS Signal with valid Lattitude and Longitude in the form of human-readable date string as per local timezone

Type

string

latitude

Latitude Timeseries

Type

pandas.DataFrame

longitude

Longitude Timeseries

Type

pandas.DataFrame

altitude

Altitude Timeseries

Type

pandas.DataFrame

success

If file reading was successful, then set to success to True

Type

bool

Returns

strymmap – Returns an object of type strymmap

Example

Generating GOOGLE MAP API KEY

You will ensure that you have right Google API KEY before you can use strymmap. You can generate API KEY at https://console.developers.google.com/projectselector2/apis/dashboard.

Put API KEY as an environment variable in the file ~/.env by executing following from the command line

echo “export GOOGLE_MAP_API_KEY=abcdefghijklmnopqrstuvwxyz” >> ~/.env

Use your own key instead of abcdefghijklmnopqrstuvwxyz.

A good tutorial on how to perform API setup is given at https://web.archive.org/web/20200404070618/https://pybit.es/persistent-environment-variables.html

Generating MAP BOX API KEY

Generating MAP BOX API key is easier than generating, Google map API Key Just create an account on mapbox.com and select create token.

You can also check tutorials on https://www.youtube.com/watch?v=6iQEhaE1bCY

Put API Key as an environment variable in the file ~/.env by executing following from the command line

echo “export MAP_BOX_API=abcdefghijklmnopqrstuvwxyz” >> ~/.env.

Use your own key instead of abcdefghijklmnopqrstuvwxyz.

>>> import strym
>>> from strym import strymmap
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> csvdata = '2020-03-20.csv'
>>> r0 = strymmap(csvfile=csvdata)
gpsdistance()

Calculate the distance covered based on the Lat, Long coordinates traversed

Returns

Distance covered in meters

plotroute(interactive=True, returnfig=False)

Plot the driving routes on Google Map

Note: Only compatble to work with Jupyter Notebook. You must execute jupyter nbextension enable –py gmaps before running jupyter notebook in your python environment.

Parameters
interactive : bool

True, False`to specify whether to plot an interactive map or not. `True: plot interactive map, False: plot map as an image

Returns

bokeh.plotting.gmap.GMap – Figure object correspond to Google Map figure with waypoints embedded on it