function leaflet_widget_process_geojson in Leaflet Widget for Geofield 7.2
Same name and namespace in other branches
- 7 leaflet_widget.module \leaflet_widget_process_geojson()
Ensures the posted values match the geofield values.
Parameters
string $geojson: The geoJSON values.
Return value
array List of geofield compatible values.
1 call to leaflet_widget_process_geojson()
- leaflet_widget_widget_validate in ./
leaflet_widget.module - Widget validation callback.
File
- ./
leaflet_widget.module, line 269 - Leaflet widget module for Geofield.
Code
function leaflet_widget_process_geojson($geojson) {
$geom = geoPHP::load($geojson, 'json');
// Avoid throwing a notice if there was a failure.
if (!$geom) {
return array();
}
$type = $geom
->geometryType();
$result = array(
'geom' => $geom
->out('wkt'),
'input_format' => 'wkt',
);
return geofield_compute_values($result);
}