Ich muss Kachelnummer in lon./lag in EPSG konvertieren: 3395, aber ich finde die Lösung nicht.Fliesennummern zu lon./lat. in EPSG: 3395
Ich habe die code for EPSG:4326 gefunden, aber ich finde keinen Weg, um es für EPSG:3395 anzupassen.
-Code für 4326 (es funktioniert gut):
$n = pow(2, $zoom);
$lon_deg = $xtile/$n * 360.0 - 180.0;
$lat_deg = rad2deg(atan(sinh(pi() * (1 - 2 * $ytile/$n))));
Ich brauche Fliesen Nummer in lon./lag in EPSG konvertieren: 3395, aber ich keine funktionierende Lösung finden. Ich habe einen Code basierend auf this answer implementiert.
wenn ich versucht habe 4326 Grad in 3395 Grad zu konvertieren:
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;
ich erhalten die folgende Fehlermeldung:
Unsupported operand type(s) for float and INT
Update: I-Code unten korrigiert wurden durch Ersetzen^mit **.
Code:
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))
Aber noch ist die Projektion seltsam. Ich nehme an, das Problem auf diesem Teil ist:
lat_deg = a * math.log(math.tan(math.radians(math.pi/4 + lat_deg/2)
Ich hatte math.radians einfügen als Math.tan nicht-Grad-Winkel mag. Irgendeine Idee?
Dies könnte helfen https://gis.stackexchange.com/questions/259121/transformation-functions-for-epsg3395-projection-vs-epsg3857 – Radan
Danke, ich habe meine Anfrage – neonepthys