Last active
August 29, 2015 13:56
-
-
Save pgiraud/9249917 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!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"> | |
| <title>Mobile full screen example</title> | |
| <style type="text/css"> | |
| html, body, .map { | |
| margin: 0; | |
| padding: 0; | |
| width: 800px; | |
| height: 600px; | |
| } | |
| </style> | |
| <link href="http://ol3js.org/en/master/css/ol.css" rel='stylesheet' type='text/css' /> | |
| </head> | |
| <body> | |
| <div id="map" class="map"></div> | |
| <script src="http://erilem.net/ol3/rotation-anchor/build/ol.js" type="text/javascript"></script> | |
| <script src="index.js" type="text/javascript"></script> | |
| <script> | |
| var view = new ol.View2D({ | |
| center: [0, 0], | |
| zoom: 2 | |
| }); | |
| var map = new ol.Map({ | |
| layers: [ | |
| new ol.layer.Tile({ | |
| source: new ol.source.OSM() | |
| }) | |
| ], | |
| target: 'map', | |
| view: view | |
| }); | |
| var anchor = [264606.61576744734, 6251044.834818743]; | |
| view.setCenter(anchor); | |
| view.setResolution(152.8740565703525); | |
| var size = map.getSize(), | |
| width = size[0], | |
| height = size[1]; | |
| var newCenter = map.getCoordinateFromPixel([width / 2, height /2]); | |
| alert(newCenter[0]); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment