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

Filtering by multiple attributes

The next step is to search the geocaching points by their attributes. For example, we may want to filter the points by the author of the geocache, by the level of difficulty to find the geocache, and so on.

We will borrow the techniques used in the methods that allowed us to get a GeoObject by its name property and the method that filtered by a polygon. The difference here is that we must allow the attribute that we want to filter by to be passed as a parameter, and we want to have the capability to combine multiple fields.

  1. Let's start adding a simple filter method in the BaseGeoCollection class:
    #... def filter(self, attribute, value): """Filters the collection by an attribute. :param attribute: The name of the attribute ...

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