(self, cache_file_name: str)
Load the track from a previously cached track

        Args:
            cache_file_name: Filename of the cached track to be loaded.

        Raises:
            TrackLoadError: An error occurred while loading the track data from the cache file.
Load the track from a previously cached track
Load the track from a previously cached track
def load_cache(self, cache_file_name: str) -> None:
        """Load the track from a previously cached track

        Args:
            cache_file_name: Filename of the cached track to be loaded.

        Raises:
            TrackLoadError: An error occurred while loading the track data from the cache file.
        """
        try:
            with open(cache_file_name, encoding="utf8") as data_file:
                data = json.load(data_file)
                self.set_start_time(datetime.datetime.strptime(data["start"], "%Y-%m-%d %H:%M:%S"))
                self.set_end_time(datetime.datetime.strptime(data["end"], "%Y-%m-%d %H:%M:%S"))
                self._length_meters = float(data["length"])
                self.polylines = []
                for data_line in data["segments"]:
                    self.polylines.append(
                        [s2sphere.LatLng.from_degrees(float(d["lat"]), float(d["lng"])) for d in data_line]
                    )
        except Exception as e:
            raise TrackLoadError("Failed to load track data from cache.") from e
def load_cache ( self , cache_file_name : str ) -> None : try : with open ( cache_file_name , encoding = "utf8" ) as data_file : data = json . load ( data_file ) self . set_start_time ( datetime . datetime . strptime ( data [ "start" ] , "%Y-%m-%d %H:%M:%S" ) ) self . set_end_time ( datetime . datetime . strptime ( data [ "end" ] , "%Y-%m-%d %H:%M:%S" ) ) self . _length_meters = float ( data [ "length" ] ) self . polylines = [ ] for data_line in data [ "segments" ] : self . polylines . append ( [ s2sphere . LatLng . from_degrees ( float ( d [ "lat" ] ) , float ( d [ "lng" ] ) ) for d in data_line ] ) except Exception as e : raise TrackLoadError ( "Failed to load track data from cache." ) from e