From: Guilhem Bonnefille Date: Sat, 28 Apr 2007 14:57:43 +0000 (+0000) Subject: Adding Maplint OpenStreetMap layer X-Git-Url: https://git.street.me.uk/andy/viking.git/commitdiff_plain/dfb4bdaad50608749d56d567f3720c7321949f6d Adding Maplint OpenStreetMap layer --- diff --git a/ChangeLog b/ChangeLog index d30cc69c..a5e84f4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-04-28 +Guilhem Bonnefille + * OpenSourceMap slippy maps (in osm.c) -- Maplink tiles + 2007-04-23 Guilhem Bonnefille * OpenSourceMap slippy maps (in osm.c) -- Osmarender and Mapnik diff --git a/src/osm.c b/src/osm.c index 0c5eed74..da5358ec 100644 --- a/src/osm.c +++ b/src/osm.c @@ -33,9 +33,11 @@ /* initialisation */ void osm_init () { VikMapsLayer_MapType osmarender_type = { 12, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, osm_coord_to_mapcoord, osm_mapcoord_to_center_coord, osm_osmarender_download }; - VikMapsLayer_MapType mapnik_type = { 13, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, osm_coord_to_mapcoord, osm_mapcoord_to_center_coord, osm_mapnik_download }; + VikMapsLayer_MapType mapnik_type = { 13, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, osm_coord_to_mapcoord, osm_mapcoord_to_center_coord, osm_mapnik_download }; VikMapsLayer_MapType maplint_type = { 14, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, osm_coord_to_mapcoord, osm_mapcoord_to_center_coord, osm_maplint_download }; + maps_layer_register_type("OpenStreetMap (Osmarender)", 12, &osmarender_type); maps_layer_register_type("OpenStreetMap (Mapnik)", 13, &mapnik_type); + maps_layer_register_type("OpenStreetMap (Maplint)", 14, &maplint_type); } /* 1 << (x) is like a 2**(x) */ @@ -81,6 +83,16 @@ void osm_mapcoord_to_center_coord ( MapCoord *src, VikCoord *dest ) 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 + */ +void osm_maplint_download ( MapCoord *src, const gchar *dest_fn ) +{ + gchar *uri = g_strdup_printf ( "/~ojw/Tiles/maplint.php/%d/%d/%d.png", 17-src->scale, src->x, src->y ); + a_http_download_get_url ( "dev.openstreetmap.org", uri, dest_fn ); + g_free ( uri ); +} + void osm_mapnik_download ( MapCoord *src, const gchar *dest_fn ) { gchar *uri = g_strdup_printf ( "/osamrender/%d/%d/%d.png", 17-src->scale, src->x, src->y ); diff --git a/src/osm.h b/src/osm.h index 8e16bb47..fe259d19 100644 --- a/src/osm.h +++ b/src/osm.h @@ -33,6 +33,7 @@ guint8 osm_zoom ( gdouble mpp ); gboolean osm_coord_to_mapcoord ( const VikCoord *src, gdouble xzoom, gdouble yzoom, MapCoord *dest ); void osm_mapcoord_to_center_coord ( MapCoord *src, VikCoord *dest ); +void osm_maplint_download ( MapCoord *src, const gchar *dest_fn ); void osm_mapnik_download ( MapCoord *src, const gchar *dest_fn ); void osm_osmarender_download ( MapCoord *src, const gchar *dest_fn );