You are here

function leaflet_widget_geojson_feature_collection in Leaflet Widget for Geofield 7.2

Same name and namespace in other branches
  1. 7 leaflet_widget.module \leaflet_widget_geojson_feature_collection()

Creates a geoJSON FeatureCollection out of an array of features.

Parameters

array $features: The features to pack into the FeatureCollection.

Return value

array A geoJSON FeatureCollection.

1 call to leaflet_widget_geojson_feature_collection()
leaflet_widget_widget_prepare_items in ./leaflet_widget.module
Prepares the field items - return a geoJSON FeatureCollection.

File

./leaflet_widget.module, line 365
Leaflet widget module for Geofield.

Code

function leaflet_widget_geojson_feature_collection($features) {
  if (!is_array($features)) {
    $features = array(
      $features,
    );
  }
  return array(
    'type' => 'FeatureCollection',
    'features' => $features,
  );
}