function geofield_get_values_from_geometry in Geofield 7
Same name and namespace in other branches
- 7.2 geofield.module \geofield_get_values_from_geometry()
Given a geometry object from geoPHP, return a values array
2 calls to geofield_get_values_from_geometry()
- geofield_compute_values in ./
geofield.module - Geofield Compute Values
- geofield_field_formatter_view in ./
geofield.formatters.inc - Implements hook_field_formatter_view().
File
- ./
geofield.module, line 232
Code
function geofield_get_values_from_geometry($geometry) {
$centroid = $geometry
->getCentroid();
$bounding = $geometry
->getBBox();
$values['wkt'] = $geometry
->out('wkt');
$values['geo_type'] = drupal_strtolower($geometry
->getGeomType());
$values['lat'] = $centroid
->getY();
$values['lon'] = $centroid
->getX();
$values['top'] = $bounding['maxy'];
$values['bottom'] = $bounding['miny'];
$values['right'] = $bounding['maxx'];
$values['left'] = $bounding['minx'];
return $values;
}