in libraries/edge/opensearch/responsewriter.py [0:0]
def _constructBoundingBoxQuery(self, value):
coords = value.split(",")
if len(coords) < 4:
return None
try:
west = float(coords[0])
south = float(coords[1])
east = float(coords[2])
north = float(coords[3])
centerY = (south + north) / 2
halfHeight = math.fabs(north - south) / 2
#Check if we need to split box into two
if (east < west):
west1 = west
east1 = 180.0
centerX1 = (west1 + east1) / 2
halfWidth1 = math.fabs(east1 - west1) / 2
west2 = -180.0
east2 = east
centerX2 = (west2 + east2) / 2
halfWidth2 = math.fabs(east2 - west2) / 2
return "fq={!frange+l=1+u=2}map(sum(" + self._solrSeparatingXAxisFunctionQueryAggregate(centerX1, halfWidth1, centerX2, halfWidth2) + "," + self._solrSeparatingYAxisFunctionQuery(centerY, halfHeight) + "),0,0,1,0)&fq=CenterY:*"
else:
centerX = (west + east) / 2
halfWidth = math.fabs(east - west) / 2
return "fq={!frange+l=1+u=2}map(sum(" + self._solrSeparatingXAxisFunctionQuery(centerX, halfWidth) + "," + self._solrSeparatingYAxisFunctionQuery(centerY, halfHeight) + "),0,0,1,0)&fq=CenterY:*"
except:
return None