geocoder icon indicating copy to clipboard operation
geocoder copied to clipboard

OpenCage Result Constructs BBox Incorrectly

Open ericbusboom opened this issue 3 years ago • 0 comments

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

ericbusboom avatar Oct 18 '21 19:10 ericbusboom