[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [4202] New naming policy for Google tiles
From: |
Pascal Brisset |
Subject: |
[paparazzi-commits] [4202] New naming policy for Google tiles |
Date: |
Fri, 25 Sep 2009 19:42:37 +0000 |
Revision: 4202
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4202
Author: hecto
Date: 2009-09-25 19:42:36 +0000 (Fri, 25 Sep 2009)
Log Message:
-----------
New naming policy for Google tiles
Modified Paths:
--------------
paparazzi3/trunk/sw/lib/ocaml/gm.ml
Modified: paparazzi3/trunk/sw/lib/ocaml/gm.ml
===================================================================
--- paparazzi3/trunk/sw/lib/ocaml/gm.ml 2009-09-24 17:36:27 UTC (rev 4201)
+++ paparazzi3/trunk/sw/lib/ocaml/gm.ml 2009-09-25 19:42:36 UTC (rev 4202)
@@ -154,9 +154,27 @@
raise Not_found in
loop 0
+(** Translate the old quadtree naming policy into new (x,y) coordinates
+ if z is the zoom level, 0 <= x, y < 2^z are the coordinates of the tile *)
+let xyz_of_qsrt = fun s ->
+ let x = ref 0
+ and y = ref 0
+ and n = String.length s in
+ for i = 1 to n - 1 do (* Skip the first t *)
+ x := !x * 2;
+ y := !y * 2;
+ match s.[i] with
+ 'q' -> ()
+ | 'r' -> incr x
+ | 's' -> incr x; incr y
+ | 't' -> incr y
+ | _ -> failwith "xy_of_qsrt"
+ done;
+ (!x, !y, n-1)
let google_maps_url = fun s ->
- sprintf "http://khm.google.com/kh?n=404&v=3&t=%s" s
+ let (x, y, z) = xyz_of_qsrt s in
+ sprintf "http://khm0.google.com/kh/v=45&x=%d&s=&y=%d&z=%d" x y z
exception Not_available
@@ -164,6 +182,7 @@
let remove_last_char = fun s -> String.sub s 0 (String.length s - 1)
+
let get_image = fun key ->
try get_from_cache key with
Not_found ->
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [4202] New naming policy for Google tiles,
Pascal Brisset <=