タイル番号をEPSG:3395のlon./lagに変換する必要がありますが、解決策が見つかりません。タイル番号をlon./latに設定します。 EPSG:3395
私はcode for EPSG:4326を見つけましたが、EPSG:3395に適合させる方法が見つかりません。
4326のコード(それがうまく機能):
$n = pow(2, $zoom);
$lon_deg = $xtile/$n * 360.0 - 180.0;
$lat_deg = rad2deg(atan(sinh(pi() * (1 - 2 * $ytile/$n))));
私はEPSGでlon./lagへのタイルの数を変換する必要があります:3395しかし、私は実用的なソリューションを見つけることができません。私はthis answerに基づいていくつかのコードを実装しました。
私は3395度に4326度を変換しようとしました:
def getVal(x, y, n):
lon_deg = x/n * 360.0 - 180.0
lat_rad = math.atan(math.sinh(math.pi * (1 - 2 * y/n)))
lat_deg = math.degrees(lat_rad)
#Convert in 3395
a = 6378137 #WGS84 semi-major axis
b = 6356752.3142 #WGS84 semi-minor axis
print(math.sqrt(1 - b^2/a^2))
e = math.sqrt(1 - b^2/a^2) #ellipsoid eccentricity
c = math.pow((1 - e*math.sin(latitude))/(1 + e*math.sin(latitude)), e/2)
lat_deg = a * ln(math.tan(math.pi/4 + lat_deg/2) * c)
lon_deg = a * lon_deg;
私は、次のエラーメッセージ取得:
Unsupported operand type(s) for float and INT
更新:私は置き換えることにより、以下のコードに修正しました^ **で。
コード:
def getVal(x, y, n):
#Calcuate coordinates in 4326
lon_deg = x/n * 360.0 - 180.0
lat_rad = math.atan(math.sinh(math.pi * (1 - 2 * y/n)))
lat_deg = math.degrees(lat_rad)
#Convert coordinates in 3395
a = 6378137 #WGS84 semi-major axis
b = 6356752.3142 #WGS84 semi-minor axis
e = math.sqrt(1 - b**2/a**2) #ellipsoid eccentricity
c = math.pow((1 - e*math.sin(lat_deg))/(1 + e*math.sin(lat_deg)), e/2)
lon_deg = a * lon_deg;
lat_deg = a * math.log(math.tan(math.radians(math.pi/4 + lat_deg/2) * c))
しかし、まだ投影が奇妙です。 私はこの問題は、この部分にあると仮定します。
lat_deg = a * math.log(math.tan(math.radians(math.pi/4 + lat_deg/2)
math.tanは度の角度を好きではないと私はmath.radiansを挿入しなければなりませんでした。
これはhttps://gis.stackexchange.com/questions/259121/transformation-functions-for-epsg3395-projection-vs-epsg3857 – Radan
おかげで、私は私を更新した – neonepthys