CloudMade implementieren
Übersicht

![]() |
HummelpupsBetreff: CloudMade implementieren |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi,
ich versuche seit einiger Zeit CloudMade zu implementieren was im grunde auch ne recht einfache Sache ist. Das einzige Problem das ich zur Zeit hab ist das umrechnen von längen/breitengrad nach x und ytile. längengrad und tilex werden immer korrekt berechnet aber latitude (breitengrad) nicht. Bier die Beschreibung von CloudMade: Code: [AUSKLAPPEN] Converting Latitude and Longitude to Tile Numbers Level: Beginner To work out which tile you need for a given latitude and longitude, you first need to pick a zoom level that you're interested in. Then calculate: n = 2 ^ zoom xtile = ((lon_deg + 180) / 360) * n ytile = (1 - (ln(tan(lat_rad) + sec(lat_rad)) / Pi)) / 2 * n Note: ln stands for natural logarithm round down xtile and ytile to get the integer tile numbers. If you need to go the other way: n = 2 ^ zoom lon_deg = xtile / n * 360.0 - 180.0 lat_rad = arctan(sinh( Pi * (1 - 2 * ytile / n))) lat_deg = lat_rad * 180.0 / Pi That should be enough to get you up and running. To get help with any of CloudMade's APIs and to keep up-to-date with our latest releases, take a look at the developers mailing list. Und meine Test-Funktionen... Code: [AUSKLAPPEN] Function GetTiles(lon:Float,lat:Float,z:Int)
Local rad:Double=lat*(Pi/180.0) Local n:Float = 2 ^ z xtile = ((lon + 180) / 360) * n ytile = (1-( Log(Tan(rad)+sec(rad)) / Pi) )/2*n End Function Function Sec:Float(val:Float) Return 1/Cos(val) End Function Function GetCoords(xtile:Float,ytile:Float,zoom:Int) Local n:Float = 2 ^ zoom lon_deg= xtile / n * 360.0 - 180.0 lat_rad= ATan(Sinh( Pi * (1 - 2 * ytile / n))) lat_deg= lat_rad * 180.0 / Pi End Function Hab ich da irgendwo nen Denkfehler drin? muss irgendwo bei der lat_ berechnung sein, die lon_ ist richtig. Grüße |
||
blucode - webdesign - Ressource - NetzwerkSim
BlitzBasic 2D - BlitzMax - MaxGUI - Monkey - BlitzPlus |
![]() |
mpmxyz |
![]() Antworten mit Zitat ![]() |
---|---|---|
Du vermischst hier wahrscheinlich Gradmaß und Bogenmaß.
Die Trigonometrischen Funktionen sind nämlich in der Mathematik und wahrscheinlich auch in diesem Programm über das Bogenmaß definiert. In BlitzBasic und BlitzMax wird der Winkel aber im Gradmaß angegeben. BlitzMax: [AUSKLAPPEN] ytile = (1-( Log(Tan(lat)+sec(lat)) / Pi) )/2*n mfG mpmxyz |
||
Moin Moin!
Projekte: DBPC CodeCruncher Mandelbrot-Renderer |
![]() |
Hummelpups |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ah so nen Mist. Haste recht. Werd's ausprobieren wenn
ich zuhause bin. Erstmal vielen dank ![]() funktioniert prächtig, danke ![]() Hätt ich auch selber drauf kommen müssen, so nen mist ey ![]() |
||
blucode - webdesign - Ressource - NetzwerkSim
BlitzBasic 2D - BlitzMax - MaxGUI - Monkey - BlitzPlus |
![]() |
Hummelpups |
![]() Antworten mit Zitat ![]() |
---|---|---|
Sehr schöne Sache ![]() Zoomen mit Mausrad, er fokussiert noch nicht gaaaanz richtig aber fast ![]() die Zielmausposition immer in der Mitte dargestellt werden, wenn man weiter ran zoomt. http://0x25.de/tmp/CloudMade-0.1.rar ![]() Dauert manchmal sehr lange bis der Server mit den Informationen rausrückt ![]() |
||
blucode - webdesign - Ressource - NetzwerkSim
BlitzBasic 2D - BlitzMax - MaxGUI - Monkey - BlitzPlus |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group