4 <title>tilingScheme 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>
24 tilingScheme test</h1>
26 This page tests initializing geomap with services requiring different tilingSchemes.</p>
28 Dynamic services are not yet implemented but will be able to be layered on top of tiled services as they don't require a tilingScheme at all.</p>
30 For this example, I have set $.geo.proj to null and am setting the center in real map units. This is because the second service, New Jersey, is not in web mercator and geomap does not provide a built-in conversion from lon/lat.</p>
32 The New Jersey service is a tiled service with an ArcGIS Server REST endpoint. The level stops of an ArcGIS Server tile cache are often not a power of two and therefore cannot be calculated. We list them all out by using the pixelSizes property of the tilingScheme instead of specifying basePixelSize and levels properties.</p>
36 Choose a service/tilingScheme combo and click <b>set</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>
37 <form action="tilingScheme.html" method="get">
40 <input type="radio" name="initService" value="defaultOsm" />
41 default OSM (web mercator via hosted images)
43 <pre><code>services: [
46 type: "tiled",
47 src: function (view) {
48 return "http://tile.openstreetmap.org/"
49 + view.zoom + "/"
50 + view.tile.column + "/"
54 attr: "© OpenStreetMap & contributors, CC-BY-SA"
61 basePixelSize: 156543.03392799936,
62 origin: [-20037508.342787, 20037508.342787]
65 <input type="radio" name="initService" value="newjersey" />
66 New Jersey (NAD83 / New Jersey (ft US); ESPG 3424 via ArcGIS Server REST API)
68 <pre><code>services: [
70 id: "NewJersey",
71 type: "tiled",
72 src: function (view) {
73 return "http://njgin.state.nj.us/ArcGIS/rest/services/Basemap/basemap/MapServer/tile/"
74 + view.zoom + "/"
75 + view.tile.row + "/"
100 origin: [-842000, 1440000]
103 <button type="submit">
105 <!--<button type="button">
106 set via property</button>-->
108 <div id="map" style="position: relative; width: 480px; height: 320px; background: #e88;">
111 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
112 <script src="../jquery.geo-test.min.js"></script>
116 var selectionOptions = {
122 src: function (view) {
123 return "http://tile.openstreetmap.org/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png";
125 attr: "© OpenStreetMap & contributors, CC-BY-SA"
132 basePixelSize: 156543.03392799936,
133 origin: [-20037508.342787, 20037508.342787]
135 center: [-8299838.279318, 4853754.340195],
144 src: function (view) {
145 return "http://njgin.state.nj.us/ArcGIS/rest/services/Basemap/basemap/MapServer/tile/" + view.zoom + "/" + view.tile.row + "/" + view.tile.column;
169 origin: [-842000, 1440000]
171 center: [458240.213369, 458773.907696],
178 search = window.location.search,
179 searchParts = search.length && search[0] == "?" ? search.slice(1).split("&") : null,
180 initService = "defaultOsm",
181 serviceChanged = false;
184 $.each(searchParts, function () {
185 var kvp = this.split("=");
188 initService = kvp[1];
189 serviceChanged = true;
195 $("input[value='" + initService + "']").click();
197 // $("button[type='button']").click(function () {
198 // initService = $("input[name='initService']:checked").val();
199 // $("#map").geomap("option", "services", selectionOptions[initService].services);
202 if (serviceChanged) {
203 window.scrollTo(0, $(document).height());
207 $("#map").geomap(selectionOptions[initService]);