-static gboolean osm_coord_to_mapcoord ( const VikCoord *src, gdouble xzoom, gdouble yzoom, MapCoord *dest )
-{
- g_assert ( src->mode == VIK_COORD_LATLON );
-
- if ( xzoom != yzoom )
- return FALSE;
-
- dest->scale = osm_zoom ( xzoom );
- if ( dest->scale == 255 )
- return FALSE;
-
- dest->x = (src->east_west + 180) / 360 * GZ(17) / xzoom;
- dest->y = (180 - MERCLAT(src->north_south)) / 360 * GZ(17) / xzoom;
- dest->z = 0;
- return TRUE;
-}
-
-static void osm_mapcoord_to_center_coord ( MapCoord *src, VikCoord *dest )
-{
- gdouble socalled_mpp = GZ(src->scale);
- dest->mode = VIK_COORD_LATLON;
- dest->east_west = ((src->x+0.5) / GZ(17) * socalled_mpp * 360) - 180;
- dest->north_south = DEMERCLAT(180 - ((src->y+0.5) / GZ(17) * socalled_mpp * 360));
-}
-
-/* Maplint tiles
- * Ex: http://dev.openstreetmap.org/~ojw/Tiles/maplint.php/10/517/375.png
- */
-static int osm_maplint_download ( MapCoord *src, const gchar *dest_fn )
-{
- int res = -1;
- gchar *uri = g_strdup_printf ( "/Tiles/maplint.php/%d/%d/%d.png", 17-src->scale, src->x, src->y );
- res = a_http_download_get_url ( "tah.openstreetmap.org", uri, dest_fn, &osm_options );
- g_free ( uri );
- return res;
-}
-
-static int osm_mapnik_download ( MapCoord *src, const gchar *dest_fn )
-{
- int res = -1;
- gchar *uri = g_strdup_printf ( "/%d/%d/%d.png", 17-src->scale, src->x, src->y );
- res = a_http_download_get_url ( "tile.openstreetmap.org", uri, dest_fn, &osm_options );
- g_free ( uri );
- return res;
-}
-
-static int osm_osmarender_download ( MapCoord *src, const gchar *dest_fn )
-{
- int res = -1;
- gchar *uri = g_strdup_printf ( "/Tiles/tile/%d/%d/%d.png", 17-src->scale, src->x, src->y );
- res = a_http_download_get_url ( "tah.openstreetmap.org", uri, dest_fn, &osm_options );
- g_free ( uri );
- return res;
-}
-
-#ifdef VIK_CONFIG_BLUEMARBLE
-static int bluemarble_download ( MapCoord *src, const gchar *dest_fn )
-{
- int res = -1;
- gchar *uri = g_strdup_printf ( "/com.modestmaps.bluemarble/%d-r%d-c%d.jpg", 17-src->scale, src->y, src->x );
- res = a_http_download_get_url ( "s3.amazonaws.com", uri, dest_fn, &osm_options );
-
- g_free ( uri );
- return res;
-
-}
-#endif
-
-#ifdef VIK_CONFIG_OPENAERIAL
-static int openaerialmap_download ( MapCoord *src, const gchar *dest_fn )
-{
- int res = -1;
- gchar *uri = g_strdup_printf ( "/tiles/1.0.0/openaerialmap-900913/%d/%d/%d.jpg", 17-src->scale, src->x, src->y );
- res = a_http_download_get_url ( "tile.openaerialmap.org", uri, dest_fn, &osm_options );
-
- g_free ( uri );
- return res;
-}
-#endif
-
-static int osm_cycle_download ( MapCoord *src, const gchar *dest_fn )
-{
- int res = -1;
- gchar *uri = g_strdup_printf ( "/tiles/cycle/%d/%d/%d.png", 17-src->scale, src->x, src->y );
- res = a_http_download_get_url ( "andy.sandbox.cloudmade.com", uri, dest_fn, &osm_options );
- g_free ( uri );
- return res;
-}