Menu

  1. 概要説明Google Earthで世界の名所めぐり
  2. Google Earth 日本測地系と世界測地系
  3. Google Earth 勝手にFAQ
  4. 紹介:ホテルの料金比較サイト 友人の作ったGoogleMapを使ったホテル紹介サイトです。触るだけでもおもしろかったです。GoogleMap は偉大です。

Google Earth 日本測地系と世界測地系

駅名 or 路線名 or 地名:

緯度経度は日本測地系(MapFan)と、世界測地系(Google Earth)の間で誤差がある。
東京近辺で、北西方向に450m(経度が約-12秒,緯度が約+12秒変化)ほどずれてしまう。


対策 Level.1


対策 Level.2

<?php require_once('cDbTools.php'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="ja"> <head> <META http-equiv="Content-Type" content="text/html;charset=EUC-JP"> <body> <h1>検索結果</h1> <?php $db = new cDbTools( 'pgsql', '127.0.0.1', 'nobody', '**********', '**********' ); if ( $db->connect() ) { #echo "SUCCESS<br> "; $keyword = mb_convert_encoding( $_REQUEST['keyword'], "EUC-JP", "EUC-JP,SJIS"); if ( $keyword == "" ) { $sql = "select pref, line, station, round(lon*1000088)/1000000, round(lat*999978)/1000000 from t_station order by station_id limit 100"; } else { $sql = sprintf("select pref, line, station, round(lon*1000088)/1000000, round(lat*999978)/1000000, lat from t_station where (line like '%%%s%%') OR ( station like '%%%s%%' ) order by station_id", $keyword, $keyword ); } $records = $db->get_select_array( $sql ); $row_count = count( $records ); printf("<table border>\n"); for( $row_idx=0;$row_idx<$row_count;$row_idx++) { $fields = $records[$row_idx]; $col_count = count( $fields ); #printf("[%s][%s]<br>\n", $fields[0], $fields[1] ); printf("<tr><td>%s</td><td>%s</td><td><a href=\"http://maps.google.com/maps?ll=%s,%s&z=3&t=k&hl=ja\">%s </a></td><td>%s,%s</td></tr>\n" , $fields[0], $fields[1], $fields[3], $fields[4], $fields[2], $fields[3], $fields[4] ); } printf("</table>\n"); $db->disconnect(); } else { echo "FAILURE<br>"; echo $db->get_error() . "<br>"; echo "</body></html>"; exit(); } ?> </body></html>

対策 Level.3(現時点の最終形態)

#!/usr/bin/perl convertGws( 35.60409444, 139.67195555 ); sub convertGws { my ( $lat, $lon ) = @_; # データ諸元 my $a_w = 6378137; # 赤道半径 my $f_w = 1 / 298.257223; # 扁平率 my $e2_w = 2*$f_w - $f_w*$f_w; # 第1離心率 my $a_t = 6377397.155; # Tokyo my $f_t = 1 / 299.152813; # Tokyo my $e2_t = 2*$f_t - $f_t*$f_t; #Tokyo # 並行移動量 [m] ( e.g. x_t + dx_t = x_w etc. ) my $dx_t = -148; my $dy_t = 507; my $dz_t = 681; my $lat_dms = $lat; my $lon_dms = $lon; my $h = 0; my @pvec = llh2xyz( $lat_dms, $lon_dms, $h, $a_t, $e2_t); @pvec = xyz2llh($pvec[0]+$dx_t, $pvec[1]+$dy_t, $pvec[2]+$dz_t, $a_w, $e2_w ); return ( $pvec[0],$pvec[1] ); } sub deg2dms { my ( $deg ) = @_; # 度 -> 度分秒 my $sf = int( $deg * 360000 + 0.5 ); my $s = int($sf/100) % 60; my $m = int($sf/6000) % 60; my $d = int($sf / 360000); $sf %= 100; return sprintf("%d/%02d/%02d.%s", $d, $m, $s, $sf ); } sub llh2xyz { # 楕円体座標 -> 直交座標 my ( $b, $l, $h, $a, $e2 ) = @_; my $rd = 3.14159265358979 / 180; $b *= $rd; $l *= $rd; my $sb = sin($b); my $cb = cos($b); my $rn = $a / sqrt(1-$e2*$sb*$sb); my $x = ($rn+$h) * $cb * cos($l); my $y = ($rn+$h) * $cb * sin($l); my $z = ($rn*(1-$e2)+$h) * $sb; return ( $x, $y, $z ); } sub xyz2llh { # 直交座標 -> 楕円体座標 my ( $x, $y, $z, $a, $e2) = @_; my $rd = 3.14159265358979 / 180; my $bda = sqrt(1-$e2); my $p = sqrt($x*$x + $y*$y); my $t = atan2($z, $p*$bda); my $st = sin($t); my $ct = cos($t); my $b = atan2($z+$e2*$a/$bda*$st*$st*$st, $p-$e2*$a*$ct*$ct*$ct); my $l = atan2($y, $x); my $sb = sin($b); my $rn = $a / sqrt(1-$e2*$sb*$sb); my $h = $p/cos($b) - $rn; return ($b/$rd, $l/$rd, $h); }