4 <title>tiled services test</title>
5 <link rel="stylesheet" type="text/css" href="css/style.css" />
6 <style type="text/css">
14 display: inline-block;
22 <a href="../" class="docLink">< docs</a>
23 <h1>tiled services test</h1>
25 <p>This page tests initializing geomap with different services that support the same tilingScheme.</p>
28 So long as all services support the current tiling scheme, they are interchangeabe without worrying about the tilingScheme property.</p>
30 Dynamic services can be layered on top of tiled services as they don't require a tilingScheme at all, however you have to make sure the map units match, e.g., the dynamic service accepts a geodetic (lon/lat) bounding box or you set $.proj to null and work entirely in a specific projection's map units.</p>
34 Choose a services array and click <b>set via init</b> to refresh the page and re-initialize the map (including center & zoom properties) or <b>set via property</b> to change only the services property at runtime.</p>
35 <form action="tiledservices.html" method="get">
38 <input type="radio" name="initService" value="defaultOsm" />
44 type: "tiled",
45 src: function (view) {
46 return "http://tile.openstreetmap.org/"
47 + view.zoom + "/"
48 + view.tile.column + "/"
52 attr: "© OpenStreetMap & contributors, CC-BY-SA"
56 <input type="radio" name="initService" value="mapquestOsm" />
61 id: "OSM_MapQuest",
62 type: "tiled",
63 src: function (view) {
64 return "http://otile" + ((view.index % 4) + 1) + ".mqcdn.com/tiles/1.0.0/osm/"
65 + view.zoom + "/"
66 + view.tile.column + "/"
70 attr: "Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>"
74 <input type="radio" name="initService" value="mapquestOrtho" />
79 id: "Ortho_MapQuest",
80 type: "tiled",
81 src: function (view) {
82 return "http://oatile" + ((view.index % 4) + 1) + ".mqcdn.com/naip/"
83 + view.zoom + "/"
84 + view.tile.column + "/"
88 attr: "Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>"
92 <input type="radio" name="initService" value="mapquestAll" />
93 MapQuest Open Ortho + MapQuest OSM at 30% opacity
97 id: "Ortho_MapQuest",
98 type: "tiled",
99 src: function (view) {
100 return "http://oatile" + ((view.index % 4) + 1) + ".mqcdn.com/naip/"
101 + view.zoom + "/"
102 + view.tile.column + "/"
106 attr: "Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>"
109 id: "OSM_MapQuest",
110 type: "tiled",
111 src: function (view) {
112 return "http://otile" + ((view.index % 4) + 1) + ".mqcdn.com/tiles/1.0.0/osm/"
113 + view.zoom + "/"
114 + view.tile.column + "/"
118 style: { opacity: .3 }
122 <button type="submit">
123 set via init</button>
124 <button type="button">
125 set via property</button>
127 <div id="map" style="position: relative; width: 480px; height: 320px; background: #e88;">
130 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
131 <script src="http://code.jquerygeo.com/jquery.geo-1.0a4.min.js"></script>
135 var selectionOptions = {
141 src: function (view) {
142 return "http://tile.openstreetmap.org/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png";
144 attr: "© OpenStreetMap & contributors, CC-BY-SA"
156 src: function (view) {
157 return "http://otile" + ((view.index % 4) + 1) + ".mqcdn.com/tiles/1.0.0/osm/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png";
159 attr: "Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>"
169 id: "Ortho_MapQuest",
171 src: function (view) {
172 return "http://oatile" + ((view.index % 4) + 1) + ".mqcdn.com/naip/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png";
174 attr: "Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>"
184 id: "Ortho_MapQuest",
186 src: function (view) {
187 return "http://oatile" + ((view.index % 4) + 1) + ".mqcdn.com/naip/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png";
189 attr: "Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>"
194 src: function (view) {
195 return "http://otile" + ((view.index % 4) + 1) + ".mqcdn.com/tiles/1.0.0/osm/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png";
197 style: { opacity: .3 }
207 search = window.location.search,
208 searchParts = search.length && search[0] == "?" ? search.slice(1).split("&") : null,
209 initService = "defaultOsm",
210 serviceChanged = false;
213 $.each(searchParts, function () {
214 var kvp = this.split("=");
217 initService = kvp[1];
218 serviceChanged = true;
224 $("input[value='" + initService + "']").click();
226 $("button[type='button']").click(function () {
227 initService = $("input[name='initService']:checked").val();
228 $("#map").geomap("option", "services", selectionOptions[initService].services);
231 if (serviceChanged) {
232 window.scrollTo(0, $(document).height());
235 $("#map").geomap(selectionOptions[initService]);