Calculating indoor route walk time

Our indoor routing application would not be complete without letting us know how long it would take to walk to our indoor walk now, would it? We will create a couple of small functions that you can insert into your code in the previous recipe to print out the route walk times.

How to do it...

  1. Without further ado, let's take a look at some code:
    #!/usr/bin/env python # -*- coding: utf-8 -*- def format_walk_time(walk_time): """ takes argument: float walkTime in seconds returns argument: string time "xx minutes xx seconds" """ if walk_time > 0.0: return str(int(walk_time / 60.0)) + " minutes " + str(int(round(walk_time % 60))) + " seconds" else: return "Walk time is less than zero! Something is wrong" def calc_distance_walktime(rows): ...

Get Python Geospatial Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.