O'Reilly logo

Geospatial Development By Example with Python by Pablo Carreira

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting your current location

So far, the application can open a file. The next step is to define your location so that we can find the closest geocache. To do this, we will change the GeocachingApp class so that it can keep track of the current location through a property. We will also create methods to change the location (similar to the geometries), transform its coordinates, and prepare it for processing.

Here are the steps that need to be performed:

  1. Edit the GeocachingApp class init method using the following code:
    #.. def __init__(self, data_file=None, my_location=None): """Application class. :param data_file: An OGR compatible file with geocaching points. """ self._datasource = None self._transformed_geoms = None self._my_location = None self.distances ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required