Example #1
0
 public function getPointsOnMap()
 {
     $locations = racelocation::all();
     $mapPoints = [];
     foreach ($locations as $location) {
         $feature = ['type' => 'Feature', 'properties' => ['title' => $location->location_name, 'id' => $location->location_id], 'geometry' => ['type' => 'Point', 'coordinates' => [floatval($location->latitude), floatval($location->longitude)]]];
         $mapPoints[] = $feature;
         // $locationGeoJson['features'][$i] = $feature;
     }
     $locationsGeoJson = ['type' => 'FeatureCollection', 'features' => $mapPoints];
     return $locationsGeoJson;
 }