投稿

Pythonで国土地理院DEMデータを利用するときのお役立ちCode & Function(その1)

イメージ
Thema: Code and Functions of processing DEM data of GSI (Geospatial Information Authority) in Japan){Python) 国土地理院(GSI)のDigital Elevtation Modelは地理院Tileという概念を用いているため、この地理院Tile座標やTile内部の個々のDEM値の位置を世界座標系で表現するPixel座標を、他のGIS(Geographic Information System)で利用されることが多い緯度経度(Longitude, Latitude)に変換しないといけない場面に遭遇します。 The case like thatのために使用するFuctionなどをIntroduceしたいと思います。 1.Tile座標を緯度経度に変換するFunction 最初に、あるTile座標とZoomがgiveされたときに、そのTileのNorth-WestEdgeのLon,Lat(Longitude,Latitude)をReturnするFunction 'tile_to_lolat'です。   # Function of exchange to lon, lat of the tile's north-west edge from the tile zoom and coodinetes / TileのZoomとx,y座標からタイル北西端の緯度経度を計算する関数 # z:zoom, x:タイルのx座標, y:タイルのy座標 def tile_to_lonlat ( z , x , y ) :     lon = ( x / 2.0 **z ) * 360 - 180 # 経度(東経)     mapy = ( y / 2.0 **z ) * 2 * pi - pi     lat = 2 * atan ( e ** ( - mapy )) * 180 / pi - 90 # 緯度(北緯)     return lon , lat Google Geminiさんに聞くと、Latitudeの計算方法は以下の2種類あるようですが、どちらの式を使っても正しい緯度...