fix scripts/mkGeolocationTable.py
* increase query limit to 10 * increase min_delay_seconds of RateLimiter to 2 seconds
This commit is contained in:
parent
08047bcff8
commit
a7d16e5b8a
@ -52,7 +52,7 @@ def mkGeolocationTable(file=''):
|
|||||||
from geopy.exc import GeocoderServiceError
|
from geopy.exc import GeocoderServiceError
|
||||||
|
|
||||||
## constants
|
## constants
|
||||||
URL = 'https://photon.komoot.io/reverse?lon={lng:.3f}&lat={lat:.3f}&limit=5'
|
URL = 'https://photon.komoot.io/reverse?lon={lng:.3f}&lat={lat:.3f}&limit=10'
|
||||||
NAMESPACES = {'sc3': 'http://geofon.gfz-potsdam.de/ns/seiscomp3-schema/0.7',
|
NAMESPACES = {'sc3': 'http://geofon.gfz-potsdam.de/ns/seiscomp3-schema/0.7',
|
||||||
'qml': 'http://quakeml.org/xmlns/bed/1.2'}
|
'qml': 'http://quakeml.org/xmlns/bed/1.2'}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ def mkGeolocationTable(file=''):
|
|||||||
# parse event.xml
|
# parse event.xml
|
||||||
DOM = ET.parse(stdin).getroot()
|
DOM = ET.parse(stdin).getroot()
|
||||||
geolocator = Photon()
|
geolocator = Photon()
|
||||||
reverse_geolocate = RateLimiter(geolocator.reverse, min_delay_seconds=1)
|
reverse_geolocate = RateLimiter(geolocator.reverse, min_delay_seconds=2)
|
||||||
|
|
||||||
# iterate over all events
|
# iterate over all events
|
||||||
count = 0
|
count = 0
|
||||||
@ -88,7 +88,7 @@ def mkGeolocationTable(file=''):
|
|||||||
else:
|
else:
|
||||||
logging.info('Processing event {id}'.format(id=publicID))
|
logging.info('Processing event {id}'.format(id=publicID))
|
||||||
try:
|
try:
|
||||||
locations = reverse_geolocate("{lat:.3f}, {lng:.3f}".format(lat=lat, lng=lng),exactly_one=False,limit=5)
|
locations = reverse_geolocate("{lat:.3f}, {lng:.3f}".format(lat=lat, lng=lng),exactly_one=False,limit=10)
|
||||||
except GeocoderServiceError:
|
except GeocoderServiceError:
|
||||||
logging.warning('Reverse Geolocation failed. Skipping event.')
|
logging.warning('Reverse Geolocation failed. Skipping event.')
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user