-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding wkt format for time-map-fast (#149)
* Adding wkt format for time-map-fast * Adding remove_water_bodies param to readme
- Loading branch information
Showing
5 changed files
with
252 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import List | ||
from traveltimepy.dto.requests.request import TravelTimeRequest | ||
from traveltimepy.dto.requests.time_map_fast import ArrivalSearches | ||
from traveltimepy.dto.responses.time_map_wkt import TimeMapWKTResponse | ||
from traveltimepy.itertools import split, flatten | ||
|
||
|
||
class TimeMapFastWKTRequest(TravelTimeRequest[TimeMapWKTResponse]): | ||
arrival_searches: ArrivalSearches | ||
|
||
def split_searches(self, window_size: int) -> List[TravelTimeRequest]: | ||
return [ | ||
TimeMapFastWKTRequest( | ||
arrival_searches=ArrivalSearches( | ||
one_to_many=one_to_many, many_to_one=many_to_one | ||
), | ||
) | ||
for one_to_many, many_to_one in split( | ||
self.arrival_searches.one_to_many, | ||
self.arrival_searches.many_to_one, | ||
window_size, | ||
) | ||
] | ||
|
||
def merge(self, responses: List[TimeMapWKTResponse]) -> TimeMapWKTResponse: | ||
return TimeMapWKTResponse( | ||
results=sorted( | ||
flatten([response.results for response in responses]), | ||
key=lambda res: res.search_id, | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters