Working with utility functions

Next, we have several utility functions that are used several times throughout the program. All of these, except the functions related to time, have been used in the previous chapters in some form. The ll2m() function converts latitude and longitude to meters. The world2pixel() function converts geospatial coordinates to pixel coordinates on our output map image. Then, we have two functions named get_utc_epoch() and get_local_time() that convert the UTC time stored in the GPX file to the local time along the route. Finally, we have a haversine distance function and our simple wms function to retrieve the map images:

def ll2m(lat, lon): """Lat/lon to meters""" x = lon * 20037508.34 / 180.0 y = math.log(math.tan((90.0 ...

Get Learning Geospatial Analysis with Python - Second Edition 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.