|
|
|
@ -22,6 +22,14 @@ class Carto::BoundingBoxHelper
|
|
|
|
|
} if result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def parse_bbox_parameters(bounding_box)
|
|
|
|
|
bbox_coords = bounding_box.split(',').map { |coord| Float(coord) rescue nil }.compact
|
|
|
|
|
if bbox_coords.length != 4
|
|
|
|
|
raise CartoDB::BoundingBoxError.new('bounding box must have 4 coordinates: minx, miny, maxx, maxy')
|
|
|
|
|
end
|
|
|
|
|
{ minx: bbox_coords[0], miny: bbox_coords[1], maxx: bbox_coords[2], maxy: bbox_coords[3] }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
# Postgis stats-based calculation of bounds. Much faster but not always present, so needs a fallback
|
|
|
|
@ -79,12 +87,4 @@ class Carto::BoundingBoxHelper
|
|
|
|
|
|
|
|
|
|
result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def parse_bbox_parameters(bounding_box)
|
|
|
|
|
bbox_coords = bounding_box.split(',').map { |coord| Float(coord) rescue nil }.compact
|
|
|
|
|
if bbox_coords.length != 4
|
|
|
|
|
raise CartoDB::BoundingBoxError.new('bounding box must have 4 coordinates: minx, miny, maxx, maxy')
|
|
|
|
|
end
|
|
|
|
|
{ minx: bbox_coords[0], miny: bbox_coords[1], maxx: bbox_coords[2], maxy: bbox_coords[3] }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|