From 1545d4dd201b7fbe3a37d9786ec4d80bd550b155 Mon Sep 17 00:00:00 2001 From: Zack LaVergne Date: Wed, 5 Feb 2020 11:24:03 -0700 Subject: [PATCH] change correlation time from 1 minute to 10 minutes --- server/config.py | 1 + server/services/mapillary_service.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/config.py b/server/config.py index 3190a024b7..341307a3de 100644 --- a/server/config.py +++ b/server/config.py @@ -56,6 +56,7 @@ class EnvironmentConfig: # Image sources MAPILLARY_API = {'base': 'https://a.mapillary.com/v3/', 'clientId': os.getenv('MAPILLARY_API_KEY', None)} + MAPILLARY_TIME_CORRELATION = os.getenv('MAPILLARY_TIME_CORRELATION', 60) # Configuration for sending emails SMTP_SETTINGS = { diff --git a/server/services/mapillary_service.py b/server/services/mapillary_service.py index 24601b0ae8..fa658a4009 100644 --- a/server/services/mapillary_service.py +++ b/server/services/mapillary_service.py @@ -74,6 +74,7 @@ class MapillaryService: @staticmethod def getMapillarySequences(parameters: dict): MAPILLARY_API = current_app.config['MAPILLARY_API'] + MAPILLARY_TIME_CORRELATION = current_app.config['MAPILLARY_TIME_CORRELATION'] parameters['client_id'] = MAPILLARY_API['clientId'] if 'bbox' not in parameters: raise ValueError("parameters must include a bbox") @@ -118,7 +119,7 @@ def getMapillarySequences(parameters: dict): task = [] task.append(feature) - for otherFeature in [f for f in features if (abs((t1 - parser.parse(f['properties']['captured_at'])).total_seconds()) <= 60)]: + for otherFeature in [f for f in features if (abs((t1 - parser.parse(f['properties']['captured_at'])).total_seconds()) <= MAPILLARY_TIME_CORRELATION)]: if otherFeature['properties']['key'] in graves: continue new = otherFeature['properties']