Ich verwende eine Karte mit einer Ebene (aus dem Beispiel):
var lonLat = new OpenLayers.LonLat(40.4088576, -86.8576718)
.transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator Projection
);
Am Ende der Bewegung erhalte ich die Koordinaten der Mitte:
map.getCenter();
map.getZoom();
und Zoomstufe: 4925535.4503328, -9668990.0134335, 12
Algorithmus aus der Dokumentation verwenden
public PointF TileToWorldPos(double tile_x, double tile_y, int zoom)
{
PointF p = new Point();
double n = Math.PI - ((2.0 * Math.PI * tile_y) / Math.Pow(2.0, zoom));
p.X = (float)((tile_x / Math.Pow(2.0, zoom) * 360.0) - 180.0);
p.Y = (float)(180.0 / Math.PI * Math.Atan(Math.Sinh(n)));
return p;
}
Ich erhalte Y ~ 90, und X ~ 432662
aber ich brauche Koordinaten in Grenzen: -180..180
etwas wie: 40.4088576, -86.8576718
Was ist los?