boundingCoordinates($radius, 'miles'); if (is_empty($VARS['names'])) { $places = $database->select('places', '*', ['AND' => [ 'latitude[>]' => $searchbounds[0]->getLatitudeInDegrees(), 'latitude[<]' => $searchbounds[1]->getLatitudeInDegrees(), 'longitude[>]' => $searchbounds[0]->getLongitudeInDegrees(), 'longitude[<]' => $searchbounds[1]->getLongitudeInDegrees()], "LIMIT" => 100 ]); } else { $places = $database->select('places', '*', ['AND' => [ 'latitude[>]' => $searchbounds[0]->getLatitudeInDegrees(), 'latitude[<]' => $searchbounds[1]->getLatitudeInDegrees(), 'longitude[>]' => $searchbounds[0]->getLongitudeInDegrees(), 'longitude[<]' => $searchbounds[1]->getLongitudeInDegrees(), 'name[!]' => ''], "LIMIT" => 100 ]); } $geo['name'] = "Places"; $geo['type'] = 'FeatureCollection'; $geo['features'] = []; foreach ($places as $place) { $geo['features'][] = array("type" => "Feature", "geometry" => [ "type" => "Point", "coordinates" => [ floatval($place['longitude']), floatval($place['latitude']) ] ], "properties" => [ "osm_id" => intval($place['osmid']), "name" => ($place['name'] == '' ? null : $place['name']), "name:en" => ($place['name'] == '' ? null : $place['name']) ] ); } echo json_encode($geo);