logo
ホーム •  フォーラム •  日本語wikiトップ •  アカウント情報 •  サイト内検索 •  新規登録
 ログイン
ユーザー名:

パスワード:


パスワード紛失

新規登録
 メインメニュー
 米国サイト
 オンライン状況
136 人のユーザが現在オンラインです。 (5 人のユーザが フォーラム を参照しています。)

登録ユーザ: 0
ゲスト: 136

もっと...

Re: Atlasの最新版を使うには?

このトピックの投稿一覧へ

なし Re: Atlasの最新版を使うには?

msg# 1.2.1.1
depth:
3
前の投稿 - 次の投稿 | 親投稿 - 子投稿なし | 投稿日時 2012-5-27 23:33 | 最終変更
toshi  長老   投稿数: 1527
hideさん、こんばんは。
toshiです。

新たに取得しなおしたterrasyncのシーナリーに対してmap.exeを実行すると正常な画像が生成できたとのこと、了解です。
terrasyncのシーナリーでもmap.exeがちゃんと動くことが分かって良かったです。

「正方形と長方形の地図画像が生成される件」についても、検証していただいた結果から、ある地点において正方形と長方形の2種類が生成されるわけではないことが理解できました。

低緯度〜中緯度は正方形、高緯度では横幅の狭い長方形の画像が生成されるということは、まったく予想していないことでした。
レポートありがとうございます。
私もテストしてみたところ、n46以上の緯度ではhideさんと同じく横幅の狭い画像が生成され、しかも横のpixel数が緯度によって異なることを確認しました。

map.exeで生成される画像の縦横のpixel数を決定しているプログラムは、AtlasソースのTiles.cxxにありました。
Atlas/CVSの最新版のTiles.cxx (rev 1.19)で言うと、1006行目付近です。
1006 	// Calculates the width and height (in pixels) of the map, given a
1007 	// resolution.
1008 	void Tile::mapSize(unsigned int level, int *width, int *height) const
1009 	{
1010 	// The height is is the same for all tiles at a given resolution
1011 	// (a degree of latitude is pretty much the same wherever you go).
1012 	// The width is set to be as 'natural' as possible, with the
1013 	// constraint that it be a power of 2. By 'natural' I mean that
1014 	// pixels in different maps should cover approximately the same
1015 	// area. Since a 1-degree tile at 30 degrees latitude is about
1016 	// half the size of a 1-degree tile at the equator, it should have
1017 	// about half the width.
1018 	*height = 1 << level;
1019 	
1020 	// The width is proportional to the height, scaled by the latitude
1021 	// (the real latitude, not our special one) and the width of tiles
1022 	// at that latitude.
1023 	double w = *height * cos(lat() * SGD_DEGREES_TO_RADIANS) * Tile::width();
1024 	
1025 	// Oh yeah, and it has to be a power of 2, and non-zero.
1026 	*width = pow(2.0, round(log2f(w)));
1027 	if (*width == 0) {
1028 	*width = 1;
1029 	}
1030 	}

levelは、サブフォルダ名にも使われている、2のべき数(4, 6, 8, 9, 10)を表します。

縦のpixel数(height)は、シフト演算子を使って
*height = 1 << level;
と書いてありますが、意味合いとしては
height = 2^level
と同義ですので、緯度経度によらず、level=10ならheight=2^10=1024になります。

横のpixel数(width)の計算はちょっとやっかいですが、1023行のcosの項は高緯度ほど小さくなります。
またTile::width()は、「standard tile width」なるものを返す関数で、その意味合いについては残念ながら良く分からないのですが、緯度0〜82度は1、83度以上で2、86度以上で4、88度以上で8、89度で360の値を取るようです(参考: Tiles.cxx (rev 1.19)824行目付近)。
なお、SGD_DEGREES_TO_RADIANSはplibのsg.hで定義されている定数で、π/180です。
1026行では、round関数で四捨五入し、2のべき乗のpixel数になるように調整した値をwidthに代入しています。
従って、緯度82度までは、高緯度ほど横pixel数は小さくなり、緯度83以上は、cosの項とTile::width()の項の効き具合により大きくなったり小さくなったりしているようです。

とりあえずこのコードに沿ってexcelでちょっと計算してところ、横pixel数は以下のようになりました。
hideさんの報告にあった緯度については、ピタリと一致しています。

■level=10の場合の横pixel数
0≦lat≦45: 1024
46≦lat≦69: 512
70≦lat≦79: 256
80≦lat≦82: 128
83≦lat≦84: 256
lat=85: 128
86≦lat≦88: 256
lat=89: 8192

引用:
(ちなみに、toshiさんが作られたものには --verbose という記述がありますが、あれは何をするためのオプションなのでしょうか)

verbose は「冗長な」という意味ですが、--verbose オプションをつけると、デフォルトでは出力しない詳細な情報をコマンドプロンプト画面に表示してくれます。
map.exeがどのファイルを処理しているのかなど、処理内容をより詳しく知ることが出来ますので、動作テストや不具合調査などに有用です。
表示内容を確認する前にコマンドプロンプト画面が消えてしまうことを防ぐために、バッチファイルの最後にPAUSEで一時停止させています。

以下は、Geoff版map.exeのオプション一覧です(--help オプションで表示できます)。
--minmax、--chunk、--force はGeoffが独自に追加したオプションであり、CVS版AtlasのMap.cxxソースコードには存在しません。

C:\Program Files\FlightGear\bin\Win32>map --help
Map - FlightGear mapping utility

Usage:
  --fg-root=path     Overrides FG_ROOT environment variable
  --fg-scenery=path  Overrides FG_SCENERY environment variable
  --atlas=path       Store maps in path
  --palette=path     Set the palette file to use
  --minmax=<lat,lon,lat,lon> Set min. and max. limits.
  --chunk=<chunk>    Limit mapping to a 10x10 degree chunk.
  --force            Force overwrite of existing images.
  --png              Create PNG images
  --jpeg             Create JPEG images with quality 75 (default)
  --jpeg=integer     Create JPEG images with specified quality
  --aafactor=integer Antialiasing factor (default = 0)
  --render-offscreen Render offscreen (default)
  --render-to-window Render to a window
  --discrete-contour Don't blend contour colours (default)
  --smooth-contour   Blend contour colours
  --no-contour-lines Don't draw contour lines (default)
  --contour-lines    Draw contour lines
  --light=azim,elev  Set light position (default = <315, 55>)
  --lighting         Light the terrain (default)
  --no-lighting      Don't light the terrain (flat light)
  --smooth-shading   Smooth polygons (default)
  --flat-shading     Don't smooth polygons
  --test             Do nothing, but report what Map would do
  --verbose          Display extra information while mapping
  --version          Print version and exit
  --help             Print this message
投票数:10 平均点:3.00

投稿ツリー

  条件検索へ


 検索

高度な検索
 新しい登録ユーザ
first21 2024-5-8
onulewusu 2024-5-8
adypuvyg 2024-5-8
ufugisix 2024-5-7
oxagoga 2024-5-7
ufujopydi 2024-5-7
upuruje 2024-5-7
otuloh 2024-5-7
fobitol573 2024-5-7
yjyzys 2024-5-7
 最近の画像(画像付)
自作11機目 F/A-18... (2022-5-27)
自作11機目 F/A-18...
飛んでみる八尾空港 (2022-4-10)
飛んでみる八尾空港
作ってみる八尾空港 (2022-4-2)
作ってみる八尾空港
F117 nighthawk (2021-5-19)
F117 nighthawk
HiTouchさん宛の画像... (2020-11-8)
HiTouchさん宛の画像...
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Theme designed by OCEAN-NET