DenisCarriere / geocoder

:earth_asia: Python Geocoder
http://geocoder.readthedocs.org
MIT License
1.62k stars 286 forks source link

OpenCage Result Constructs BBox Incorrectly #447

Open ericbusboom opened 2 years ago

ericbusboom commented 2 years ago

The OpenCageResult.bbox property is defined as:

@property
def bbox(self):
    south = self._bounds.get('southwest', {}).get('lat')
    north = self._bounds.get('northeast', {}).get('lat')
    west = self._bounds.get('southwest', {}).get('lng')
    east = self._bounds.get('northeast', {}).get('lng')
    if all([south, west, north, east]):
        return BBox.factory([south, west, north, east]).as_dict

But the BBox initializer expects a list argument, in BBox.__init__ to be:

    elif bbox is not None and all(bbox):
        self.west, self.south, self.east, self.north = map(float, bbox)

It looks like OpenCageResult.bbox should be changed to:

return BBox.factory([west, south, east, north]).as_dict