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:
- 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 = None if data_file: self.open_file(data_file) if my_location: self.my_location = my_location...