--- a/champlain/champlain-network-tile-source.c +++ b/champlain/champlain-network-tile-source.c @@ -484,6 +484,24 @@ g_object_notify (G_OBJECT (tile_source), "offline"); } +static void get_quadkey(gchar *q, gint x, gint y, gint z) +{ + gint i; + + for (i = --z; i >= 0; i--) + { + char digit = '0'; + + if (x & (1 << i)) + digit += 1; + + if (y & (1 << i)) + digit += 2; + + *q++ = digit; + } + *q = 0; +} #define SIZE 8 static gchar * @@ -524,6 +542,13 @@ g_snprintf (value, SIZE, "%d", number); g_string_append (ret, value); } + else if (strcmp (token, "Q") == 0) + { + gchar *q = alloca(z+1); + + get_quadkey (q, x, y, z); + g_string_append (ret, q); + } else g_string_append (ret, token);