Hallo,

 > aber woher hole ich mir lat/lon aus
> der URL: http://tile.openstreetmap.org/15/17294/10588.png

Das kann man ganz einfach ausrechnen (15 ist der Zoomlevel, danach kommt 
die X-Koordinate, dann Y):

+ package org.openstreetmap.josm.data.projection;
+
+ /**
+  * Class that handles conversion between unprojected co-ordinates and
+  * slippy map tile co-ordinates.
+  *
+  * All methods take a zoom level as their first argument, specifying
+  * the slippy map zoom level. The slippy map divides the world into
+  * an equal number (2 ^ (zoom-1)) of rows and columns. See
+  *
+  * http://wiki.openstreetmap.org/index.php/Slippy_map_tilenames
+  *
+  * for details.
+  *
+  * @author Frederik Ramm <[EMAIL PROTECTED]>
+  */
+ public class SlippyMap {
+       
+       public static int latToTileY(int zoom, double lat) {
+               if ((zoom < 3) || (zoom > 18)) return -1;
+               double l = lat / 180 * Math.PI;
+               double pf = Math.log(Math.tan(l) + (1/Math.cos(l)));
+               return (int) ((1<<(zoom-1)) * (Math.PI - pf) / Math.PI);
+       }
+       
+       public static int lonToTileX(int zoom, double lon) {
+               if ((zoom < 3) || (zoom > 18)) return -1;
+               return (int) ((1<<(zoom-3)) * (lon + 180.0) / 45.0);
+       }
+       
+       public static double tileYToLat(int zoom, int y) {
+               if ((zoom < 3) || (zoom > 18)) return Double.MIN_VALUE;
+               return Math.atan(Math.sinh(Math.PI - (Math.PI*y / 
(1<<(zoom-1))))) * 
180 / Math.PI;
+       }
+       
+       public static double tileXToLon(int zoom, int x) {
+               if ((zoom < 3) || (zoom > 18)) return Double.MIN_VALUE;
+               return x * 45.0 / (1<<(zoom-3)) - 180.0;
+       }
+ }

Das ist jetzt Java, ich habs auch noch irgendwo in Perl rumliegen, aber 
eigentlich sollte das ja einfach in jede Sprache uebersetzbar sein. Bei 
den tileTo...-Methoden kommt immer die obere linke Ecke des Tiles raus; 
um die untere rechte zu kriegen, musst Du einfach zu x/y eins addieren.

Bye
Frederik

-- 
Frederik Ramm  ##  eMail [EMAIL PROTECTED]  ##  N49°00.09' E008°23.33'

_______________________________________________
Talk-de mailing list
[email protected]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk-de

Antwort per Email an