public function BBoxArgument::getParsedBoundingBox in Views GeoJSON 8
Parses the bounding box argument.
Parses the bounding box argument. Returns an array keyed 'top', 'left', 'bottom', 'right' or FALSE if the argument was not parsed succesfully.
Return value
array|bool The calculated values.
1 call to BBoxArgument::getParsedBoundingBox()
- BBoxArgument::query in src/
Plugin/ views/ argument/ BBoxArgument.php - If we've been passed a bounding box, it's parsable, and the view style has a geofield, then we work out which fields to add to the query and add a where clause.
File
- src/
Plugin/ views/ argument/ BBoxArgument.php, line 122
Class
- BBoxArgument
- Argument handler for Bounding Boxes.
Namespace
Drupal\views_geojson\Plugin\views\argumentCode
public function getParsedBoundingBox() {
static $values;
if (!isset($values)) {
$exploded_values = explode(',', $this
->getValue());
if (count($exploded_values) == 4) {
$values['left'] = (double) $exploded_values[0];
$values['bottom'] = (double) $exploded_values[1];
$values['right'] = (double) $exploded_values[2];
$values['top'] = (double) $exploded_values[3];
if ($this->options['round_coordinates']) {
$values['left'] -= 0.005;
$values['bottom'] -= 0.005;
$values['right'] += 0.005;
$values['top'] += 0.005;
foreach ($values as $k => $v) {
$values[$k] = round($values[$k], 2);
}
}
}
else {
$values = FALSE;
}
}
return $values;
}