Skip to content

Commit

Permalink
#118 Error handling for bbox
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Mar 1, 2015
1 parent d209744 commit 64d8617
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 4 additions & 7 deletions geocoder/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,10 @@ def status(self):

def _get_bbox(self, south, west, north, east):
# South Latitude, West Longitude, North Latitude, East Longitude
try:
self.south = float(south)
self.west = float(west)
self.north = float(north)
self.east = float(east)
except:
pass
self.south = south
self.west = west
self.north = north
self.east = east

# Bounding Box Corners
self.northeast = [self.north, self.east]
Expand Down
8 changes: 7 additions & 1 deletion geocoder/yandex.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ def bbox(self):
if self.parse['Envelope']:
east, north = self.parse['Envelope'].get('upperCorner').split(' ')
west, south = self.parse['Envelope'].get('lowerCorner').split(' ')
return self._get_bbox(south, west, north, east)
try:
return self._get_bbox(float(south),
float(west),
float(north),
float(east))
except:
pass

@property
def quality(self):
Expand Down

0 comments on commit 64d8617

Please sign in to comment.