diff options
Diffstat (limited to 'design')
-rw-r--r-- | design/sass/_leaflet.scss | 1 | ||||
-rw-r--r-- | design/sass/stylesv6.sass | 1 | ||||
-rw-r--r-- | design/templates/archives/map.html | 8 | ||||
-rw-r--r-- | design/templates/details/national-parks.html | 25 | ||||
-rw-r--r-- | design/templates/details/photo_galleries.html | 7 | ||||
-rw-r--r-- | design/templates/gis/admin/openlayers.html | 38 | ||||
-rw-r--r-- | design/templates/js/leaflet-providers.js | 472 |
7 files changed, 538 insertions, 14 deletions
diff --git a/design/sass/_leaflet.scss b/design/sass/_leaflet.scss new file mode 100644 index 0000000..b65ffb8 --- /dev/null +++ b/design/sass/_leaflet.scss @@ -0,0 +1 @@ +.leaflet-map-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-pane,.leaflet-tile-container,.leaflet-overlay-pane,.leaflet-shadow-pane,.leaflet-marker-pane,.leaflet-popup-pane,.leaflet-overlay-pane svg,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden;-ms-touch-action:none}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container img{max-width:none !important}.leaflet-container img.leaflet-image-layer{max-width:15000px !important}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-tile-pane{z-index:2}.leaflet-objects-pane{z-index:3}.leaflet-overlay-pane{z-index:4}.leaflet-shadow-pane{z-index:5}.leaflet-marker-pane{z-index:6}.leaflet-popup-pane{z-index:7}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:7;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-tile,.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;-o-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-tile-loaded,.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);-o-transition:-o-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile,.leaflet-touching .leaflet-zoom-animated{-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-clickable{cursor:pointer}.leaflet-container{cursor:-webkit-grab;cursor:-moz-grab}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-container,.leaflet-dragging .leaflet-clickable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing}.leaflet-container{background:#ddd;outline:0}.leaflet-container a{color:#0078A8}.leaflet-container a.leaflet-active{outline:2px solid orange}.leaflet-zoom-box{border:2px dotted #38f;background:rgba(255,255,255,.5)}.leaflet-container{font:12px/1.5 "Helvetica Neue",Arial,Helvetica,sans-serif}.leaflet-bar{box-shadow:0 1px 5px rgba(0,0,0,.65);border-radius:4px}.leaflet-bar a,.leaflet-bar a:hover{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:black}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:bold 18px 'Lucida Console',Monaco,monospace;text-indent:1px}.leaflet-control-zoom-out{font-size:20px}.leaflet-touch .leaflet-control-zoom-in{font-size:22px}.leaflet-touch .leaflet-control-zoom-out{font-size:24px}.leaflet-control-layers{box-shadow:0 1px 5px rgba(0,0,0,.4);background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(images/layers.png);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(images/layers-2x.png);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-container .leaflet-control-attribution{background:#fff;background:rgba(255,255,255,.7);margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover{text-decoration:underline}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale{font-size:11px}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;font-size:11px;white-space:nowrap;overflow:hidden;-moz-box-sizing:content-box;box-sizing:content-box;background:#fff;background:rgba(255,255,255,.5)}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 19px;line-height:1.4}.leaflet-popup-content p{margin:18px 0}.leaflet-popup-tip-container{margin:0 auto;width:40px;height:20px;position:relative;overflow:hidden}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:white;box-shadow:0 3px 14px rgba(0,0,0,.4)}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;padding:4px 4px 0 0;text-align:center;width:18px;height:14px;font:16px/14px Tahoma,Verdana,sans-serif;color:#c3c3c3;text-decoration:none;font-weight:700;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover{color:#999}.leaflet-popup-scrolled{overflow:auto;border-bottom:1px solid #ddd;border-top:1px solid #ddd}.leaflet-oldie .leaflet-popup-content-wrapper{zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678,M12=0.70710678,M21=-0.70710678,M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678,M12=0.70710678,M21=-0.70710678,M22=0.70710678)}.leaflet-oldie .leaflet-popup-tip-container{margin-top:-1px}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666} diff --git a/design/sass/stylesv6.sass b/design/sass/stylesv6.sass index 77e5e06..41ed20f 100644 --- a/design/sass/stylesv6.sass +++ b/design/sass/stylesv6.sass @@ -4,6 +4,7 @@ @import _480.sass @import _768.sass @import _992.sass +@import _leaflet.scss diff --git a/design/templates/archives/map.html b/design/templates/archives/map.html index 550a898..0b43e6e 100644 --- a/design/templates/archives/map.html +++ b/design/templates/archives/map.html @@ -9,14 +9,13 @@ Google Maps code ==============================================#} {% block extrahead %} - <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" /> <!--[if lte IE 8]> - <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css" /> + <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.ie.css" /> <![endif]--> - <script src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script> + <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> <script type="text/javascript"> if (typeof L === "undefined") { - document.write(unescape("%3Cscript src='/media/js/leaflet-0.5/leaflet.js' type='text/javascript'%3E%3C/script%3E")); + document.write(unescape("%3Cscript src='/media/js/leaflet-0.7.3/leaflet.js' type='text/javascript'%3E%3C/script%3E")); } </script> @@ -64,7 +63,6 @@ Google Maps code </section> {% endblock %} {% block js %} -<script type="text/javascript" src="/media/js/leaflet-providers.js"></script> <!--<script type="text/javascript" src="/media/js/mainmap.js"></script>--> <script type="text/javascript" src="/media/js/mainmap.min.js"></script> {% endblock%} diff --git a/design/templates/details/national-parks.html b/design/templates/details/national-parks.html index e17bd72..2cd48eb 100644 --- a/design/templates/details/national-parks.html +++ b/design/templates/details/national-parks.html @@ -3,6 +3,25 @@ {% block pagetitle %}Luxagraf | Projects | National Parks {% endblock %} {% block metadescription %}{% endblock %} +{% block extrahead %} + <!--[if lte IE 8]> + <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.ie.css" /> + <![endif]--> + <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> + <script type="text/javascript"> + if (typeof L === "undefined") { + document.write(unescape("%3Cscript src='/media/js/leaflet-0.5/leaflet.js' type='text/javascript'%3E%3C/script%3E")); +} + </script> + + <style> + #map-canvas img{ border: none;} + </style> + + + + +{% endblock %} {%block bodyid%}id="projects-detail"{%endblock%} @@ -25,8 +44,8 @@ <ul class="buttons"> <li><a href="{{object.post.get_absolute_url}}" title="{{object.post.title}}">Read Journal</a></li> {%if object.gallery%}<li><a href="{{object.gallery.get_absolute_url}}" title="Photos of {{object.unit_name}}">View Photos</a></li>{%endif%} - <li><a href="#" class="map-link" title="{{object.mpoly.centroid.y}},{{object.mpoly.centroid.x}},{{object.zoom}},{{object.id}}">Map</a></li> - <li><a href="#" id="more-{{forloop.counter}}"class="more-link" title="More about {{object.unit_name}}">More</a></li> + <li><a href="#" class="map-link" data-latitude="{{object.mpoly.centroid.y}}" data-longitude="{{object.mpoly.centroid.x}}" data-zoom="{{object.zoom}}" data-id="{{object.id}}">Map</a></li> + <li><a href="#" id="more-{{forloop.counter}}" class="more-link" title="More about {{object.unit_name}}">More</a></li> </ul> <dl class="meta" style="visibility: hidden;"> <dt>Visited:</dt> @@ -46,8 +65,6 @@ {% endblock %} {% block js %} <script type="text/javascript" src="/media/js/jquery.js"></script> - <script type="text/javascript" src="/media/js/underscore-min.js"></script> <script type="text/javascript" src="/media/js/natparks.min.js" ></script> - <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> {% endblock %} diff --git a/design/templates/details/photo_galleries.html b/design/templates/details/photo_galleries.html index 4e8fdce..e0530ab 100644 --- a/design/templates/details/photo_galleries.html +++ b/design/templates/details/photo_galleries.html @@ -9,11 +9,10 @@ {% block metadescription %}{{object.set_desc|truncatewords:30|smartypants|safe}}{% endblock %} {% block extrahead %} - <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" /> <!--[if lte IE 8]> - <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css" /> + <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.ie.css" /> <![endif]--> - <script src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script> + <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> <script type="text/javascript"> if (typeof L === "undefined") { document.write(unescape("%3Cscript src='/media/js/leaflet-0.5/leaflet.js' type='text/javascript'%3E%3C/script%3E")); @@ -83,8 +82,6 @@ {% block js %} <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.js"></script> <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.scrollTo-1.4.2-min.js"></script> - <!--<script type="text/javascript" src="{{MEDIA_URL}}js/photos.min.js" ></script>--> - <script type="text/javascript" src="/media/js/leaflet-providers.js"></script> <script type="text/javascript" src="/media/js/photos.min.js" ></script> diff --git a/design/templates/gis/admin/openlayers.html b/design/templates/gis/admin/openlayers.html new file mode 100644 index 0000000..a61b689 --- /dev/null +++ b/design/templates/gis/admin/openlayers.html @@ -0,0 +1,38 @@ +{% block extrastyle %} +{% load static %} +<style type="text/css"> + #{{ id }}_map { width: {{ map_width }}px; height: {{ map_height }}px; } + #{{ id }}_map .aligned label { float:inherit; } + #{{ id }}_admin_map { position: relative; vertical-align: top; float: {{ LANGUAGE_BIDI|yesno:"right,left" }}; } + {% if not display_wkt %}#{{ id }} { display: none; }{% endif %} + .olControlEditingToolbar .olControlModifyFeatureItemActive { + background-image: url("{% static "admin/img/gis/move_vertex_on.png" %}"); + background-repeat: no-repeat; + } + .olControlEditingToolbar .olControlModifyFeatureItemInactive { + background-image: url("{% static "admin/img/gis/move_vertex_off.png" %}"); + background-repeat: no-repeat; + } +</style> +<!--[if IE]> +<style type="text/css"> + /* This fixes the mouse offset issues in IE. */ + #{{ id }}_admin_map { position: static; vertical-align: top; } + /* `font-size: 0` fixes the 1px border between tiles, but borks LayerSwitcher. + Thus, this is disabled until a better fix is found. + #{{ id }}_map { width: {{ map_width }}px; height: {{ map_height }}px; font-size: 0; } */ +</style> +<![endif]--> +{% endblock %} +<span id="{{ id }}_admin_map"> +<script type="text/javascript"> +//<![CDATA[ +{% block openlayers %}{% include "gis/admin/openlayers.js" %}{% endblock %} +//]]> +</script> +<div id="{{ id }}_map"{% if LANGUAGE_BIDI %} dir="ltr"{% endif %}></div> +<a href="javascript:{{ module }}.clearFeatures()">Delete all Features</a> +{% if display_wkt %}<p> WKT debugging window:</p>{% endif %} +<textarea id="{{ id }}" class="vWKTField required" cols="150" rows="10" name="{{ name }}">{{ wkt }}</textarea> +<script type="text/javascript">{% block init_function %}{{ module }}.init();{% endblock %}</script> +</span> diff --git a/design/templates/js/leaflet-providers.js b/design/templates/js/leaflet-providers.js new file mode 100644 index 0000000..c339c8b --- /dev/null +++ b/design/templates/js/leaflet-providers.js @@ -0,0 +1,472 @@ +(function () { + 'use strict'; + + L.TileLayer.Provider = L.TileLayer.extend({ + initialize: function (arg, options) { + var providers = L.TileLayer.Provider.providers; + + var parts = arg.split('.'); + + var providerName = parts[0]; + var variantName = parts[1]; + + if (!providers[providerName]) { + throw 'No such provider (' + providerName + ')'; + } + + var provider = { + url: providers[providerName].url, + options: providers[providerName].options + }; + + // overwrite values in provider from variant. + if (variantName && 'variants' in providers[providerName]) { + if (!(variantName in providers[providerName].variants)) { + throw 'No such variant of ' + providerName + ' (' + variantName + ')'; + } + var variant = providers[providerName].variants[variantName]; + var variantOptions; + if (typeof variant === 'string') { + variantOptions = { + variant: variant + }; + } else { + variantOptions = variant.options; + } + provider = { + url: variant.url || provider.url, + options: L.Util.extend({}, provider.options, variantOptions) + }; + } else if (typeof provider.url === 'function') { + provider.url = provider.url(parts.splice(1, parts.length - 1).join('.')); + } + + // replace attribution placeholders with their values from toplevel provider attribution, + // recursively + var attributionReplacer = function (attr) { + if (attr.indexOf('{attribution.') === -1) { + return attr; + } + return attr.replace(/\{attribution.(\w*)\}/, + function (match, attributionName) { + return attributionReplacer(providers[attributionName].options.attribution); + } + ); + }; + provider.options.attribution = attributionReplacer(provider.options.attribution); + + // Compute final options combining provider options with any user overrides + var layerOpts = L.Util.extend({}, provider.options, options); + L.TileLayer.prototype.initialize.call(this, provider.url, layerOpts); + } + }); + + /** + * Definition of providers. + * see http://leafletjs.com/reference.html#tilelayer for options in the options map. + */ + + //jshint maxlen:220 + L.TileLayer.Provider.providers = { + OpenStreetMap: { + url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + options: { + attribution: + '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + + '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>' + }, + variants: { + Mapnik: {}, + BlackAndWhite: { + url: 'http://{s}.www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png' + }, + DE: { + url: 'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png' + }, + HOT: { + url: 'http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', + options: { + attribution: '{attribution.OpenStreetMap}, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>' + } + } + } + }, + OpenSeaMap: { + url: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', + options: { + attribution: 'Map data: © <a href="http://www.openseamap.org">OpenSeaMap</a> contributors' + } + }, + Thunderforest: { + url: 'http://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png', + options: { + attribution: + '© <a href="http://www.opencyclemap.org">OpenCycleMap</a>, {attribution.OpenStreetMap}', + variant: 'cycle' + }, + variants: { + OpenCycleMap: 'cycle', + Transport: 'transport', + Landscape: 'landscape', + Outdoors: 'outdoors' + } + }, + OpenMapSurfer: { + url: 'http://openmapsurfer.uni-hd.de/tiles/{variant}/x={x}&y={y}&z={z}', + options: { + minZoom: 0, + maxZoom: 20, + variant: 'roads', + attribution: 'Imagery from <a href="http://giscience.uni-hd.de/">GIScience Research Group @ University of Heidelberg</a> — Map data {attribution.OpenStreetMap}' + }, + variants: { + Roads: 'roads', + AdminBounds: { + options: { + variant: 'adminb', + maxZoom: 19 + } + }, + Grayscale: { + options: { + variant: 'roadsg', + maxZoom: 19 + } + } + } + }, + MapQuestOpen: { + url: 'http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg', + options: { + attribution: + 'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — ' + + 'Map data {attribution.OpenStreetMap}', + subdomains: '1234' + }, + variants: { + OSM: {}, + Aerial: { + url: 'http://oatile{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg', + options: { + attribution: + 'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — ' + + 'Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency' + } + } + } + }, + MapBox: { + url: function (id) { + return 'http://{s}.tiles.mapbox.com/v3/' + id + '/{z}/{x}/{y}.png'; + }, + options: { + attribution: + 'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> — ' + + 'Map data {attribution.OpenStreetMap}', + subdomains: 'abcd' + } + }, + Stamen: { + url: 'http://{s}.tile.stamen.com/{variant}/{z}/{x}/{y}.png', + options: { + attribution: + 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' + + '<a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — ' + + 'Map data {attribution.OpenStreetMap}', + subdomains: 'abcd', + minZoom: 0, + maxZoom: 20, + variant: 'toner' + }, + variants: { + Toner: 'toner', + TonerBackground: 'toner-background', + TonerHybrid: 'toner-hybrid', + TonerLines: 'toner-lines', + TonerLabels: 'toner-labels', + TonerLite: 'toner-lite', + Terrain: { + options: { + variant: 'terrain', + minZoom: 4, + maxZoom: 18 + } + }, + TerrainBackground: { + options: { + variant: 'terrain-background', + minZoom: 4, + maxZoom: 18 + } + }, + Watercolor: { + options: { + variant: 'watercolor', + minZoom: 3, + maxZoom: 16 + } + } + } + }, + Esri: { + url: 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}', + options: { + variant: 'World_Street_Map', + attribution: 'Tiles © Esri' + }, + variants: { + WorldStreetMap: { + options: { + attribution: + '{attribution.Esri} — ' + + 'Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012' + } + }, + DeLorme: { + options: { + variant: 'Specialty/DeLorme_World_Base_Map', + minZoom: 1, + maxZoom: 11, + attribution: '{attribution.Esri} — Copyright: ©2012 DeLorme' + } + }, + WorldTopoMap: { + options: { + variant: 'World_Topo_Map', + attribution: + '{attribution.Esri} — ' + + 'Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community' + } + }, + WorldImagery: { + options: { + variant: 'World_Imagery', + attribution: + '{attribution.Esri} — ' + + 'Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' + } + }, + WorldTerrain: { + options: { + variant: 'World_Terrain_Base', + maxZoom: 13, + attribution: + '{attribution.Esri} — ' + + 'Source: USGS, Esri, TANA, DeLorme, and NPS' + } + }, + WorldShadedRelief: { + options: { + variant: 'World_Shaded_Relief', + maxZoom: 13, + attribution: '{attribution.Esri} — Source: Esri' + } + }, + WorldPhysical: { + options: { + variant: 'World_Physical_Map', + maxZoom: 8, + attribution: '{attribution.Esri} — Source: US National Park Service' + } + }, + OceanBasemap: { + options: { + variant: 'Ocean_Basemap', + maxZoom: 13, + attribution: '{attribution.Esri} — Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri' + } + }, + NatGeoWorldMap: { + options: { + variant: 'NatGeo_World_Map', + maxZoom: 16, + attribution: '{attribution.Esri} — National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC' + } + }, + WorldGrayCanvas: { + options: { + variant: 'Canvas/World_Light_Gray_Base', + maxZoom: 16, + attribution: '{attribution.Esri} — Esri, DeLorme, NAVTEQ' + } + } + } + }, + OpenWeatherMap: { + url: 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png', + options: { + attribution: 'Map data © <a href="http://openweathermap.org">OpenWeatherMap</a>', + opacity: 0.5 + }, + variants: { + Clouds: 'clouds', + CloudsClassic: 'clouds_cls', + Precipitation: 'precipitation', + PrecipitationClassic: 'precipitation_cls', + Rain: 'rain', + RainClassic: 'rain_cls', + Pressure: 'pressure', + PressureContour: 'pressure_cntr', + Wind: 'wind', + Temperature: 'temp', + Snow: 'snow' + } + }, + HERE: { + /* + * HERE maps, formerly Nokia maps. + * These basemaps are free, but you need an API key. Please sign up at + * http://developer.here.com/getting-started + * + * Note that the base urls contain '.cit' whichs is HERE's + * 'Customer Integration Testing' environment. Please remove for production + * envirionments. + */ + url: + 'http://{s}.{base}.maps.cit.api.here.com/maptile/2.1/' + + 'maptile/{mapID}/{variant}/{z}/{x}/{y}/256/png8?' + + 'app_id={app_id}&app_code={app_code}', + options: { + attribution: + 'Map © 1987-2014 <a href="http://developer.here.com">HERE</a>', + subdomains: '1234', + mapID: 'newest', + 'app_id': '<insert your app_id here>', + 'app_code': '<insert your app_code here>', + base: 'base', + variant: 'normal.day', + minZoom: 0, + maxZoom: 20 + }, + variants: { + normalDay: 'normal.day', + normalDayCustom: 'normal.day.custom', + normalDayGrey: 'normal.day.grey', + normalDayMobile: 'normal.day.mobile', + normalDayGreyMobile: 'normal.day.grey.mobile', + normalDayTransit: 'normal.day.transit', + normalDayTransitMobile: 'normal.day.transit.mobile', + normalNight: 'normal.night', + normalNightMobile: 'normal.night.mobile', + normalNightGrey: 'normal.night.grey', + normalNightGreyMobile: 'normal.night.grey.mobile', + + carnavDayGrey: 'carnav.day.grey', + hybridDay: { + options: { + base: 'aerial', + variant: 'hybrid.day' + } + }, + hybridDayMobile: { + options: { + base: 'aerial', + variant: 'hybrid.day.mobile' + } + }, + pedestrianDay: 'pedestrian.day', + pedestrianNight: 'pedestrian.night', + satelliteDay: { + options: { + base: 'aerial', + variant: 'satellite.day' + } + }, + terrainDay: { + options: { + base: 'aerial', + variant: 'terrain.day' + } + }, + terrainDayMobile: { + options: { + base: 'aerial', + variant: 'terrain.day.mobile' + } + } + } + }, + Acetate: { + url: 'http://a{s}.acetate.geoiq.com/tiles/{variant}/{z}/{x}/{y}.png', + options: { + attribution: + '©2012 Esri & Stamen, Data from OSM and Natural Earth', + subdomains: '0123', + minZoom: 2, + maxZoom: 18, + variant: 'acetate-base' + }, + variants: { + basemap: 'acetate-base', + terrain: 'terrain', + all: 'acetate-hillshading', + foreground: 'acetate-fg', + roads: 'acetate-roads', + labels: 'acetate-labels', + hillshading: 'hillshading' + } + } + }; + + L.tileLayer.provider = function (provider, options) { + return new L.TileLayer.Provider(provider, options); + }; + + L.Control.Layers.Provided = L.Control.Layers.extend({ + initialize: function (base, overlay, options) { + var first; + + var labelFormatter = function (label) { + return label.replace(/\./g, ': ').replace(/([a-z])([A-Z])/g, '$1 $2'); + }; + + if (base.length) { + (function () { + var out = {}, + len = base.length, + i = 0; + + while (i < len) { + if (typeof base[i] === 'string') { + if (i === 0) { + first = L.tileLayer.provider(base[0]); + out[labelFormatter(base[i])] = first; + } else { + out[labelFormatter(base[i])] = L.tileLayer.provider(base[i]); + } + } + i++; + } + base = out; + }()); + this._first = first; + } + + if (overlay && overlay.length) { + (function () { + var out = {}, + len = overlay.length, + i = 0; + + while (i < len) { + if (typeof overlay[i] === 'string') { + out[labelFormatter(overlay[i])] = L.tileLayer.provider(overlay[i]); + } + i++; + } + overlay = out; + }()); + } + L.Control.Layers.prototype.initialize.call(this, base, overlay, options); + }, + onAdd: function (map) { + this._first.addTo(map); + return L.Control.Layers.prototype.onAdd.call(this, map); + } + }); + + L.control.layers.provided = function (baseLayers, overlays, options) { + return new L.Control.Layers.Provided(baseLayers, overlays, options); + }; +}()); + |