コード例 #1
0
ファイル: Twitter.php プロジェクト: Eupeodes/gh
 public function dailyCoords($date)
 {
     $base_dir = BASE_DIR;
     $this->hash = new \view\Hash();
     $res = $this->hash->cron($date);
     $maxLength = 80 - 2 * $this->short_url_length;
     foreach ($res as $key => $hash) {
         if ($key > 0) {
             $msg = 'Eastern (W30) offset ' . $hash['date'] . ': ' . round($hash['east']->lat, 5) . ', ' . round($hash['east']->lng, 5) . ' https://geohashing.info/' . str_replace('-', '', $hash['date']) . '/s #geohashing';
             $this->queue($msg);
             $msg = 'Globalhash ' . $hash['date'] . ': ' . round($hash['global']->lat, 5) . ', ' . round($hash['global']->lng, 5) . ', ' . \model\GeoName::get($hash['global']->lat, $hash['global']->lng, $maxLength)->geoName . ' https://geohashing.info/' . str_replace('-', '', $hash['date']) . '/global #geohashing';
             copy('http://maps.googleapis.com/maps/api/staticmap?center=0,0&size=640x640&sensor=false&zoom=1&markers=color:blue%7C' . $hash['global']->lat . ',' . $hash['global']->lng . '&key=AIzaSyDZpNi_G0_KqacSGUWW6a76EvIZgvFNiVk&maptype=satellite', $base_dir . '/cache/global_' . str_replace('-', '', $hash['date']) . '.png');
             $this->queue($msg, $base_dir . '/cache/global_' . str_replace('-', '', $hash['date']) . '.png');
         }
         if (!is_null($hash['west'])) {
             $msg = 'Western (Non-W30) offset ' . $hash['date'] . ': ' . round($hash['west']->lat, 5) . ', ' . round($hash['west']->lng, 5) . ' https://geohashing.info/' . str_replace('-', '', $hash['date']) . '/s #geohashing';
             $this->queue($msg);
         }
     }
 }
コード例 #2
0
ファイル: IrcBot.php プロジェクト: Eupeodes/gh
 private function sendGlobal($data, $date)
 {
     $this->send((date('Y-m-d') === $date ? 'Today\'s globalhash' : 'Globalhash of ' . $date) . ': ' . $data->lat . ', ' . $data->lng . ', ' . \model\GeoName::get($data->lat, $data->lng)->geoName . ' https://geohashing.info/' . date('Ymd') . '/global');
     //post the global
 }
コード例 #3
0
ファイル: GeoName.php プロジェクト: Eupeodes/gh
 public function view()
 {
     header('Content-Type: application/json');
     echo json_encode(\model\GeoName::get(filter_input(INPUT_GET, 'lat', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), filter_input(INPUT_GET, 'lng', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)));
 }