Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

CountryFilter

marcjulianschwarz edited this page Feb 23, 2022 · 3 revisions

class watchlib.filtering.CountryFilter()

This filter will only select routes which were recorded in the BBox of a given country. Currently it only supports the following countries:

  • All
  • Italy
  • Germany
  • Austria

More/all countries are coming soon.

from watchlib.filtering import CountryFilter

germany_bbox = CountryFilter.countries["Germany"]
cf = CountryFilter(german_bbox)

Parameters

  • country_bbox : BBox -> BBox

Properties

  • countries : Dict[str, BBox] -> BBox and see supported countries

Methods

Filtering

Use the filter() method to filter a list of WorkoutRoute according to country_bbox.

Parameters:

Returns:

Usage: routes is a list of WorkoutRoute previously loaded using DataLoader or CacheHandler.

from watchlib.filtering import CountryFilter

germany_bbox = CountryFilter.countries["Germany"]
cf = CountryFilter(german_bbox)
filtered_routes = cf.filter(routes)

# len(filtered_routes) <= len(routes)