]>
Commit | Line | Data |
---|---|---|
67209ca8 GB |
1 | /* |
2 | * viking -- GPS Data and Topo Analyzer, Explorer, and Manager | |
3 | * | |
4 | * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net> | |
a482007a | 5 | * Copyright (C) 2007, Guilhem Bonnefille <guilhem.bonnefille@gmail.com> |
67209ca8 GB |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 | * | |
21 | */ | |
8c00358d GB |
22 | #ifdef HAVE_CONFIG_H |
23 | #include "config.h" | |
24 | #endif | |
67209ca8 | 25 | |
92806042 | 26 | #include <glib/gi18n.h> |
67209ca8 | 27 | |
67209ca8 | 28 | #include "osm.h" |
f7d8a3c2 | 29 | #include "vikmapslayer.h" |
8eb12ac6 | 30 | #include "vikslippymapsource.h" |
50713970 | 31 | #include "vikwmscmapsource.h" |
92806042 GB |
32 | #include "vikwebtoolcenter.h" |
33 | #include "vikexttools.h" | |
5149a69d GB |
34 | #include "vikgotoxmltool.h" |
35 | #include "vikgoto.h" | |
4f92972b | 36 | |
67209ca8 GB |
37 | /* initialisation */ |
38 | void osm_init () { | |
0f08bd0d GB |
39 | VikMapSource *osmarender_type = |
40 | VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE, | |
41 | "id", 12, | |
42 | "label", "OpenStreetMap (Osmarender)", | |
43 | "hostname", "tah.openstreetmap.org", | |
44 | "url", "/Tiles/tile/%d/%d/%d.png", | |
6693f5f9 | 45 | "check-file-server-time", TRUE, |
05dbd9ba | 46 | "use-etag", FALSE, |
82aa018d | 47 | "copyright", "© OpenStreetMap contributors", |
53ac8302 GB |
48 | "license", "CC-BY-SA", |
49 | "license-url", "http://www.openstreetmap.org/copyright", | |
0f08bd0d GB |
50 | NULL)); |
51 | VikMapSource *mapnik_type = | |
52 | VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE, | |
53 | "id", 13, | |
54 | "label", "OpenStreetMap (Mapnik)", | |
55 | "hostname", "tile.openstreetmap.org", | |
56 | "url", "/%d/%d/%d.png", | |
05dbd9ba JJ |
57 | "check-file-server-time", FALSE, |
58 | "use-etag", TRUE, | |
82aa018d | 59 | "copyright", "© OpenStreetMap contributors", |
53ac8302 GB |
60 | "license", "CC-BY-SA", |
61 | "license-url", "http://www.openstreetmap.org/copyright", | |
0f08bd0d GB |
62 | NULL)); |
63 | VikMapSource *maplint_type = | |
64 | VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE, | |
65 | "id", 14, | |
66 | "label", "OpenStreetMap (Maplint)", | |
67 | "hostname", "tah.openstreetmap.org", | |
68 | "url", "/Tiles/maplint.php/%d/%d/%d.png", | |
6693f5f9 | 69 | "check-file-server-time", TRUE, |
05dbd9ba | 70 | "use-etag", FALSE, |
82aa018d | 71 | "copyright", "© OpenStreetMap contributors", |
53ac8302 GB |
72 | "license", "CC-BY-SA", |
73 | "license-url", "http://www.openstreetmap.org/copyright", | |
0f08bd0d GB |
74 | NULL)); |
75 | VikMapSource *cycle_type = | |
76 | VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE, | |
77 | "id", 17, | |
78 | "label", "OpenStreetMap (Cycle)", | |
218cdecd GB |
79 | "hostname", "b.tile.opencyclemap.org", |
80 | "url", "/cycle/%d/%d/%d.png", | |
6693f5f9 | 81 | "check-file-server-time", TRUE, |
05dbd9ba | 82 | "use-etag", FALSE, |
82aa018d | 83 | "copyright", "© OpenStreetMap contributors", |
53ac8302 GB |
84 | "license", "CC-BY-SA", |
85 | "license-url", "http://www.openstreetmap.org/copyright", | |
0f08bd0d | 86 | NULL)); |
bf6152e8 | 87 | VikMapSource *wms_type = |
50713970 GB |
88 | VIK_MAP_SOURCE(g_object_new(VIK_TYPE_WMSC_MAP_SOURCE, |
89 | "id", 18, | |
90 | "label", "OpenStreetMap (WMS)", | |
91 | "hostname", "full.wms.geofabrik.de", | |
92 | "url", "/std/demo_key?LAYERS=osm-full&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=&SRS=EPSG:4326&BBOX=%s,%s,%s,%s&WIDTH=256&HEIGHT=256", | |
93 | "check-file-server-time", FALSE, | |
82aa018d | 94 | "copyright", "© OpenStreetMap contributors", |
53ac8302 GB |
95 | "license", "CC-BY-SA", |
96 | "license-url", "http://www.openstreetmap.org/copyright", | |
50713970 | 97 | NULL)); |
db03733a GB |
98 | |
99 | maps_layer_register_map_source (osmarender_type); | |
100 | maps_layer_register_map_source (mapnik_type); | |
101 | maps_layer_register_map_source (maplint_type); | |
102 | maps_layer_register_map_source (cycle_type); | |
50713970 | 103 | maps_layer_register_map_source (wms_type); |
92806042 GB |
104 | |
105 | // Webtools | |
106 | VikWebtoolCenter *webtool = NULL; | |
107 | webtool = vik_webtool_center_new_with_members ( _("OSM (view)"), "http://openstreetmap.org/?lat=%s&lon=%s&zoom=%d&layers=B000FTF" ); | |
108 | vik_ext_tools_register ( VIK_EXT_TOOL ( webtool ) ); | |
109 | g_object_unref ( webtool ); | |
110 | ||
111 | webtool = vik_webtool_center_new_with_members ( _("OSM (edit)"), "http://www.openstreetmap.org/edit?lat=%s&lon=%s&zoom=%d" ); | |
112 | vik_ext_tools_register ( VIK_EXT_TOOL ( webtool ) ); | |
113 | g_object_unref ( webtool ); | |
114 | ||
115 | webtool = vik_webtool_center_new_with_members ( _("OSM (render)"), "http://www.informationfreeway.org/?lat=%s&lon=%s&zoom=%d&layers=B0000F000F" ); | |
116 | vik_ext_tools_register ( VIK_EXT_TOOL ( webtool ) ); | |
117 | g_object_unref ( webtool ); | |
5149a69d GB |
118 | |
119 | // Goto | |
120 | VikGotoXmlTool *nominatim = VIK_GOTO_XML_TOOL ( g_object_new ( VIK_GOTO_XML_TOOL_TYPE, "label", "OSM Nominatim", | |
121 | "url-format", "http://nominatim.openstreetmap.org/search?q=%s&format=xml", | |
122 | "lat-path", "/searchresults/place", | |
123 | "lat-attr", "lat", | |
124 | "lon-path", "/searchresults/place", | |
125 | "lon-attr", "lon", | |
126 | NULL ) ); | |
127 | vik_goto_register ( VIK_GOTO_TOOL ( nominatim ) ); | |
128 | g_object_unref ( nominatim ); | |
54cef17b GB |
129 | |
130 | VikGotoXmlTool *namefinder = VIK_GOTO_XML_TOOL ( g_object_new ( VIK_GOTO_XML_TOOL_TYPE, "label", "OSM Name finder", | |
131 | "url-format", "http://gazetteer.openstreetmap.org/namefinder/search.xml?find=%s&max=1", | |
132 | "lat-path", "/searchresults/named", | |
133 | "lat-attr", "lat", | |
134 | "lon-path", "/searchresults/named", | |
135 | "lon-attr", "lon", | |
136 | NULL ) ); | |
137 | vik_goto_register ( VIK_GOTO_TOOL ( namefinder ) ); | |
138 | g_object_unref ( namefinder ); | |
67209ca8 GB |
139 | } |
140 |