-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbasemap-tiles.min.js
1 lines (1 loc) · 2.39 KB
/
basemap-tiles.min.js
1
(function(){var a={geolandbasemap:{format:'png'},bmapgrau:{format:'png'},bmaphidpi:{format:'jpg'},bmapgelaende:{format:'jpg',style:'grau'},bmaporthofoto30cm:{format:'jpg'},bmapoverlay:{format:'png'}};typeof google=="object"&&typeof google.maps=="object"&&(google.maps.ImageMapType=function(a){var b=function(){if(!arguments.length)return;a.apply(this,arguments)};return b.prototype=a.prototype,b}(google.maps.ImageMapType),google.maps.BasemapMapType=function(b){if(!(b in a))throw new Error('Map type not found');let{format:c,style:d='normal'}=a[b];return google.maps.ImageMapType.call(this,{getTileUrl:function(h,i){var a=1<<i,e=h.x%a,f=e<0?e+a:e,g=h.y,j=function(b){var c=Math.sin(b.lat*Math.PI/180);return{x:Math.floor((.5+b.lng/360)*a),y:Math.floor((.5-Math.log((1+c)/(1-c))/(4*Math.PI))*a)}},k=[{lat:46.41,lng:9.53},{lat:49.02,lng:17.17}],l=j(k[0]),m=j(k[1]);return f>m.x||g<m.y||f<l.x||g>l.y?null:"//mapsneu.wien.gv.at/basemap/{N}/{S}/google3857/{Z}/{Y}/{X}.{F}".replace("{N}",b).replace("{S}",d).replace("{Z}",i).replace("{X}",f).replace("{Y}",g).replace("{F}",c)},tileSize:new google.maps.Size(256,256),name:b,alt:'Tiles © basemap.at',minZoom:3,maxZoom:19})},google.maps.BasemapMapType.prototype=new google.maps.ImageMapType,Basemap=function(a){var c=new google.maps.BasemapMapType(window.devicePixelRatio==1?'geolandbasemap':'bmaphidpi'),d=new google.maps.BasemapMapType('bmapgelaende'),e=new google.maps.BasemapMapType('bmaporthofoto30cm'),f=new google.maps.BasemapMapType('bmapoverlay'),g=new google.maps.LatLngBounds(new google.maps.LatLng(46.41,9.53),new google.maps.LatLng(49.02,17.17)),h=a.addListener('maptypeid_changed',function(){a.getMapTypeId()=='terrain'&&(a.overlayMapTypes.clear(),a.overlayMapTypes.insertAt(0,d)),(a.getMapTypeId()=='hybrid'||a.getMapTypeId()=='satellite')&&(a.overlayMapTypes.clear(),a.overlayMapTypes.insertAt(0,e)),(a.getMapTypeId()=='hybrid'||a.getMapTypeId()=='terrain')&&a.overlayMapTypes.insertAt(1,f),a.getMapTypeId()=='roadmap'&&(a.overlayMapTypes.clear(),a.overlayMapTypes.push(c))}),b=document.createElement('div');b.innerHTML='Datenquelle: <a href="http://www.basemap.at/" target="_blank">basemap.at</a>',b.style.cssText='white-space: nowrap;background-color: #fff;opacity: .7;padding: 1px 5px 2px;font-size: 10px',a.controls[google.maps.ControlPosition.BOTTOM_RIGHT].push(b),a.overlayMapTypes.clear(),a.overlayMapTypes.push(c),a.setOptions({restriction:{latLngBounds:g,strictBounds:!1}})})})()