UNPKG

openlayers-test

Version:

Build tools and sources for developing OpenLayers based mapping applications

132 lines (121 loc) 4.36 kB
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="chrome=1"> <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"> <link rel="stylesheet" href="../css/ol.css" type="text/css"> <link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css"> <link rel="stylesheet" href="../resources/layout.css" type="text/css"> <link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css"> <style> .mapcontainer { position: relative; margin-bottom: 20px; } .map { width: 1000px; height: 600px; } div.ol-zoom { top: 178px; left: 158px; } div.ol-attribution { bottom: 30px; right: 50px; } .padding-top { position: absolute; top: 0; left: 0px; width: 1000px; height: 170px; background: rgba(255, 255, 255, 0.5); } .padding-left { position: absolute; top: 170px; left: 0; width: 150px; height: 400px; background: rgba(255, 255, 255, 0.5); } .padding-right { position: absolute; top: 170px; left: 950px; width: 50px; height: 400px; background: rgba(255, 255, 255, 0.5); } .padding-bottom { position: absolute; top: 570px; left: 0px; width: 1000px; height: 30px; background: rgba(255, 255, 255, 0.5); } .center { position: absolute; border: solid 1px black; top: 490px; left: 560px; width: 20px; height: 20px; } </style> <title>Advanced View Positioning example</title> </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a class="brand" href="./"><img src="../resources/logo.png">OpenLayers 3 Examples</a> </div> </div> </div> <div class="container-fluid"> <div class="row-fluid"> <div class="span12 mapcontainer"> <div id="map" class="map"></div> <div class="padding-top"></div> <div class="padding-left"></div> <div class="padding-right"></div> <div class="padding-bottom"></div> <div class="center"></div> </div> </div> <div class="row-fluid"> <div class="span12"> <button id="zoomtoswitzerlandbest">Zoom to Switzerland</button> (best fit),<br/> <button id="zoomtoswitzerlandconstrained">Zoom to Switzerland</button> (respect resolution constraint).<br/> <button id="zoomtoswitzerlandnearest">Zoom to Switzerland</button> (nearest),<br/> <button id="zoomtolausanne">Zoom to Lausanne</button> (with min resolution),<br/> <button id="centerlausanne">Center on Lausanne</button> </div> </div> <div class="row-fluid"> <div class="span12"> <h4 id="title">Advanced View Positioning example</h4> <p id="shortdesc">This example demonstrates how a map's view can be adjusted so a geometry or coordinate is positioned at a specific pixel location. The map above has top, right, bottom, and left padding applied inside the viewport. The view's <code>fitGeometry</code> method is used to fit a geometry in the view with the same padding. The view's <code>centerOn</code> method is used to position a coordinate (Lausanne) at a specific pixel location (the center of the black box).</p> <div id="docs"> <p>Use <code>Alt</code>+<code>Shift</code>+drag to rotate the map.</p> <p>See the <a href="center.js" target="_blank">center.js source</a> to see how this is done.</p> </div> <div id="tags">center, rotation, openstreetmap</div> </div> </div> </div> <script src="../resources/jquery.min.js" type="text/javascript"></script> <script src="loader.js?id=center" type="text/javascript"></script> <script src="../resources/example-behaviour.js" type="text/javascript"></script> </body> </html>