1.1 --- a/EventAggregatorSupport.py Mon Mar 26 00:22:45 2012 +0200
1.2 +++ b/EventAggregatorSupport.py Mon Mar 26 19:06:52 2012 +0200
1.3 @@ -93,6 +93,24 @@
1.4 else:
1.5 return None
1.6
1.7 +def getLocationPosition(location, locations):
1.8 +
1.9 + """
1.10 + Attempt to return the position of the given 'location' using the 'locations'
1.11 + dictionary provided. If no position can be found, return a latitude of None
1.12 + and a longitude of None.
1.13 + """
1.14 +
1.15 + latitude, longitude = None, None
1.16 +
1.17 + if location is not None:
1.18 + try:
1.19 + latitude, longitude = map(getMapReference, locations[location].split())
1.20 + except (KeyError, ValueError):
1.21 + pass
1.22 +
1.23 + return latitude, longitude
1.24 +
1.25 def to_list(s, sep):
1.26 return [x.strip() for x in s.split(sep) if x.strip()]
1.27