Skip to content

Commit

Permalink
Integrate overpass API
Browse files Browse the repository at this point in the history
Change that integrates the paid overpass API with not only the integration test, but the overall functionality of match_stops.py
  • Loading branch information
nataliejschultz committed Jun 14, 2024
1 parent 177f78d commit 41a9785
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions emission/net/ext_service/transit_matching/match_stops.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@
import requests
import attrdict as ad
import itertools
import copy
import os
import time

try:
config_file = open('conf/net/ext_service/overpass_server.json')
OVERPASS_KEY = os.environ.get("OVERPASS_KEY")
url = 'http://overpass.geofabrik.de/' + OVERPASS_KEY + '/'
print("overpass configured")
except:
print("overpass not configured, falling back to default overleaf.de")
config_file = open('conf/net/ext_service/overpass_server.json.sample')
url = "https://lz4.overpass-api.de/"

try:
query_file = open('conf/net/ext_service/overpass_transit_stops_query_template')
except:
print("transit stops query not configured, falling back to default")
query_file = open('conf/net/ext_service/overpass_transit_stops_query_template.sample')

config_data = json.load(config_file)
url = config_data["url"]

query_string = "".join(query_file.readlines())

RETRY = -1
Expand Down

0 comments on commit 41a9785

Please sign in to comment.