Guest User

Untitled

a guest
Oct 10th, 2020
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.73 KB | None | 0 0
  1.  
  2. <!DOCTYPE html>
  3. <html>
  4.   <head>
  5.     <title></title>
  6.     <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3/css/ol.css" type="text/css">
  7.  
  8.     <script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3/build/ol.js"></script>
  9.  
  10.     <script type="text/javascript">
  11.       function initialize() {
  12.         var zoom = 8;
  13.         var side = 800
  14.         var extent = [0, 0, zoom*side*2, zoom*side*2];
  15.         var center = [zoom*side+400/8/2, zoom*side-400/8/2];
  16.         console.log(center)
  17.         var projection = new ol.proj.Projection({
  18.           code: 'decentraland-images',
  19.           units: 'pixels',
  20.           extent: extent,
  21.         });
  22.         var map = new ol.Map({
  23.         target: 'map',
  24.         layers: [
  25.           new ol.layer.Tile({
  26.             source: new ol.source.TileImage({
  27.               url: 'map/{z},{x},{y}.png',
  28.               wrapX: false,
  29.             }),
  30.           }),
  31.           new ol.layer.Tile({
  32.              source: new ol.source.TileDebug(),
  33.           })
  34.         ],
  35.         view: new ol.View({
  36.             projection: projection,
  37.             center: center, //ol.extent.getCenter(extent),
  38.             zoom: zoom,
  39.             minZoom: zoom,
  40.             maxZoom: zoom,
  41.           })
  42.         });
  43.       }
  44.     </script>
  45.     <style type="text/css">
  46.       #map {
  47.         min-height: 100%;
  48.         position: fixed;
  49.         width: 100%;
  50.         height: 100%;
  51.         left: 0;
  52.         top: 0;
  53.         background: rgba(51,51,51,0.7);
  54.       }
  55.       html, body {
  56.         height: 100%;
  57.         margin: 0;
  58.       }
  59.     </style>
  60.   </head>
  61.   <body onload="initialize()">
  62.     <div id="map">
  63.     </div>
  64.   </body>
  65. </html>
  66.  
  67.  
Add Comment
Please, Sign In to add comment