2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

proj.4で経緯度からいきなりWebメルカトルのピクセル座標やタイル座標を出す方法

Last updated at Posted at 2014-01-12

ピクセル座標を出す場合、ズームレベルをzとして、座標系定義({}の中は計算結果の定数を入れる)

proj4定義
+proj=merc +a={Math.pow(2,z+7) / Math.PI} +b={Math.pow(2,z+7) / Math.PI} +lat_ts=0.0 +lon_0=0.0 +x_0={Math.pow(2,z+7)} +y_0=-{Math.pow(2,z+7)} +k=1.0 +axis=esu +units=m +nadgrids=@null +no_defs

で定義し、epsg:4326との間で変換してやればよい。
もちろん、結果は小数点座標で出るので、整数が必要であればfloorする事。

gdal2tilesに通す場合は、+axis定義が効かないので、ワールドファイルで

ワールドファイル定義
1.0
0.0
0.0
-1.0
0.0
0.0

を指定してやって対処。

タイル座標を出す場合、同様に、

proj4定義
+proj=merc +a={Math.pow(2,z-1) / Math.PI} +b={Math.pow(2,z-1) / Math.PI} +lat_ts=0.0 +lon_0=0.0 +x_0={Math.pow(2,z-1)} +y_0=-{Math.pow(2,z-1)} +k=1.0 +axis=esu +units=m +nadgrids=@null +no_defs

で望む座標系定義が得られる。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?