You are here

private function views_geojson_bbox_argument::_explode_bbox_coords in Views GeoJSON 7

Same name and namespace in other branches
  1. 6 views/views_geojson_bbox_argument.inc \views_geojson_bbox_argument::_explode_bbox_coords()

Split BBOX string into {left, bottom, right, top}.

Parameters

string $bbox_coords_str: 4 comma delimited coordinates.

Return value

array Array of 4 valid bbox coordinates or empty array if coordinates are invalid.

1 call to views_geojson_bbox_argument::_explode_bbox_coords()
views_geojson_bbox_argument::query in views/views_geojson_bbox_argument.inc
Use the argument to modify the query.

File

views/views_geojson_bbox_argument.inc, line 223

Class

views_geojson_bbox_argument
Custom filter to return only points within a provided bounding box.

Code

private function _explode_bbox_coords($bbox_coords_str) {
  if (!is_string($bbox_coords_str)) {
    return array();
  }
  $bbox_coords = explode(',', $bbox_coords_str);
  if (count($bbox_coords) === 4) {
    if (!$this
      ->_check_bbox_coords($bbox_coords)) {
      return array();
    }
    return array(
      'left' => $bbox_coords[0],
      'bottom' => $bbox_coords[1],
      'right' => $bbox_coords[2],
      'top' => $bbox_coords[3],
    );
  }
  return array();
}