File "test.php"
Full path: /www/ais_management/model/test.php
File size: 3.28 KiB (3361 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
//print $data_get ."<BR>";
//print_r($data_split);
// APIアクセスURL
$url = 'https://umayadia-apisample.azurewebsites.net/api/persons';
// ストリームコンテキストのオプションを作成
$options = array(
// HTTPコンテキストオプションをセット
'http' => array(
'method'=> 'GET',
'header'=> 'Content-type: application/json; charset=UTF-8' //JSON形式で表示
)
);
// ストリームコンテキストの作成
$context = stream_context_create($options);
$raw_data = file_get_contents($url, false,$context);
/*
$device_id = 600222000533;
$api = "https://openapi.safie.link/v1/devices/" .$device_id ."/location";
https://openapi.safie.link/v1/devices/600222000533/location
$json = file_get_contents($api);
$json = mb_convert_encoding($json, 'UTF8', 'ASCII,JIS,UTF-8,EUC-JP,SJIS-WIN');
$arr = json_decode($json,true);
//$ct = count($arr['data']);
print_r($arr);
*/
/*
$epsg = file_get_contents("/www/ais_management/setting/epsg.txt");
$lat = 34.717797;
$lon = 135.298207;
$pg_exe = "/usr/local/bin/python315 /www/ais_management/gps_conv.py " .$epsg ." " .$lat ." " .$lon;
$output = "";
$cmd = exec($pg_exe,$output);
print_r($output);
*/
/*
echo "■緯度の計算<br />\n";
$cf = 2*pi()*6378150; // 円周
echo "円周:{$cf}(m)<br />\n"; //円周:40075035.5351(m)
$time = $cf/360; // 1度
echo "1度:{$time}(m)<br />\n"; //1度:111319.543153(m)
$sec = $cf/(360*60*60); // 1秒
echo "1秒:{$sec}(m)<br />\n"; //1秒:30.9220953203(m)
echo "1秒を度で示すと " . (1/60/60) . "度<br />\n"; //1秒を度で示すと 0.000277777777778度
echo "1メートルを度で示すと " . sprintf("%.15f", (1/60/60) / $sec) . "度<br />\n";//1メートルを度で示すと 0.000008983148616度
echo "■経度の計算<br />\n";
$lat = 34;
$cf = cos($lat/180*pi())*2*pi()*6378150; // 円周
echo "円周:{$cf}(m)<br />\n"; //円周:32827598.7524(m)
$time = $cf/360; // 1度
echo "1度:{$time}(m)<br />\n"; //1度:91187.7743122(m)
$sec = $cf/(360*60*60); // 1秒
echo "1秒:{$sec}(m)<br />\n"; //1秒:25.329937309(m)
echo "1秒を度で示すと " . (1/60/60) . "度<br />\n"; //1秒を度で示すと 0.000277777777778度
echo "1メートルを度で示すと " . sprintf("%.15f", (1/60/60) / $sec) . "度<br />\n"; //1メートルを度で示すと 0.000010966382364度
*/
/*
//施工場所
$position = explode(",",file_get_contents("/www/ais_management/setting/position.txt"));
//AIS船舶の取得範囲
$search_range = file_get_contents("/www/ais_management/setting/search_range.txt") * 1000;
//施工場所の座標から取得範囲の座標を設定
//緯度(1m辺りの座標)
$lat_m = 0.000008983148616;
//経度(1m辺りの座標 緯度は34度の場合)0.000010835618106
$lon_m = 0.000010835618106;
$area_st['lat'] = $position[0] - $lat_m * $search_range;
$area_st['lon'] = $position[1] - $lon_m * $search_range;
$area_end['lat'] = $position[0] + $lat_m * $search_range;
$area_end['lon'] = $position[1] + $lon_m * $search_range;
//エリア出力(テスト用)
$area_output = $position[0] ."," .$position[1] ."\n" .$area_st['lat'] ."," .$area_st['lon'] ."\n" .$area_end['lat'] ."," .$area_end['lon'];
file_put_contents("/www/ais_management/setting/area.txt",$area_output);
*/
?>