Merge branch 'master' of github.com:openlayers/ol3 into vector
This commit is contained in:
@@ -5,10 +5,10 @@ goog.require('ol.AnchoredElement');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.Projection');
|
||||
goog.require('ol.RendererHints');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.MapQuestOpenAerial');
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ var map = new ol.Map({
|
||||
// Vienna label
|
||||
var vienna = new ol.AnchoredElement({
|
||||
map: map,
|
||||
position: ol.Projection.transformWithCodes(
|
||||
position: ol.projection.transformWithCodes(
|
||||
new ol.Coordinate(16.3725, 48.208889), 'EPSG:4326', 'EPSG:3857'),
|
||||
element: document.getElementById('vienna')
|
||||
});
|
||||
@@ -49,7 +49,7 @@ map.addEventListener('click', function(evt) {
|
||||
var coordinate = evt.getCoordinate();
|
||||
popup.getElement().innerHTML =
|
||||
'Welcome to ol3. The location you clicked was<br>' +
|
||||
ol.Coordinate.toStringHDMS(ol.Projection.transformWithCodes(
|
||||
ol.Coordinate.toStringHDMS(ol.projection.transformWithCodes(
|
||||
coordinate, 'EPSG:3857', 'EPSG:4326'));
|
||||
popup.setPosition(coordinate);
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.Projection');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.DebugTileSource');
|
||||
goog.require('ol.source.OpenStreetMap');
|
||||
goog.require('ol.tilegrid.XYZ');
|
||||
@@ -16,7 +16,7 @@ var layers = new ol.Collection([
|
||||
}),
|
||||
new ol.layer.TileLayer({
|
||||
source: new ol.source.DebugTileSource({
|
||||
projection: ol.Projection.getFromCode('EPSG:3857'),
|
||||
projection: ol.projection.getFromCode('EPSG:3857'),
|
||||
tileGrid: new ol.tilegrid.XYZ({
|
||||
maxZoom: 22
|
||||
})
|
||||
@@ -26,7 +26,7 @@ var layers = new ol.Collection([
|
||||
|
||||
var webglMap = new ol.Map({
|
||||
view: new ol.View2D({
|
||||
center: ol.Projection.transformWithCodes(
|
||||
center: ol.projection.transformWithCodes(
|
||||
new ol.Coordinate(-0.1275, 51.507222), 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 10
|
||||
}),
|
||||
|
||||
47
examples/epsg-4326.html
Normal file
47
examples/epsg-4326.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; 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="style.css" type="text/css">
|
||||
<style type="text/css">
|
||||
html, body, #map {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#text {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
z-index: 20000;
|
||||
background-color: white;
|
||||
padding: 0 0.5em 0.5em 0.5em;
|
||||
border-radius: 4px;
|
||||
}
|
||||
@media only screen and (max-width: 600px) {
|
||||
#text {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<title>EPSG:4326 example</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map">
|
||||
<div id="text">
|
||||
<h1 id="title">EPSG:4326 example</h1>
|
||||
<div id="shortdesc">Example of a epsg-4326 map.</div>
|
||||
<div id="docs">
|
||||
<p>See the
|
||||
<a href="epsg-4326.js" target="_blank">epsg-4326.js source</a>
|
||||
to see how this is done.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tags">epsg4326</div>
|
||||
<script src="loader.js?id=epsg-4326" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
56
examples/epsg-4326.js
Normal file
56
examples/epsg-4326.js
Normal file
@@ -0,0 +1,56 @@
|
||||
goog.require('goog.debug.Console');
|
||||
goog.require('goog.debug.Logger');
|
||||
goog.require('goog.debug.Logger.Level');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.TiledWMS');
|
||||
|
||||
|
||||
if (goog.DEBUG) {
|
||||
goog.debug.Console.autoInstall();
|
||||
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
|
||||
}
|
||||
|
||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||
|
||||
// We give the single image source a set of resolutions. This prevents the
|
||||
// source from requesting images of arbitrary resolutions.
|
||||
var projectionExtent = epsg4326.getExtent();
|
||||
var maxResolution = Math.max(
|
||||
projectionExtent.maxX - projectionExtent.minX,
|
||||
projectionExtent.maxY - projectionExtent.minY) / 256;
|
||||
var resolutions = new Array(10);
|
||||
for (var i = 0; i < 10; ++i) {
|
||||
resolutions[i] = maxResolution / Math.pow(2.0, i);
|
||||
}
|
||||
|
||||
var layers = new ol.Collection([
|
||||
new ol.layer.TileLayer({
|
||||
source: new ol.source.TiledWMS({
|
||||
url: 'http://vmap0.tiles.osgeo.org/wms/vmap0',
|
||||
crossOrigin: null,
|
||||
params: {
|
||||
'LAYERS': 'basic',
|
||||
'FORMAT': 'image/jpeg'
|
||||
},
|
||||
projection: epsg4326
|
||||
})
|
||||
})
|
||||
]);
|
||||
|
||||
var map = new ol.Map({
|
||||
layers: layers,
|
||||
// The OSgeo server does not set cross origin headers, so we cannot use WebGL
|
||||
renderers: [ol.RendererHint.CANVAS, ol.RendererHint.DOM],
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
projection: epsg4326,
|
||||
center: new ol.Coordinate(0, 0),
|
||||
zoom: 2
|
||||
})
|
||||
});
|
||||
@@ -4,7 +4,6 @@ goog.require('goog.debug.Logger.Level');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.Projection');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.animation');
|
||||
@@ -12,6 +11,7 @@ goog.require('ol.control.MousePosition');
|
||||
goog.require('ol.easing');
|
||||
goog.require('ol.interaction.Keyboard');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.MapQuestOpenAerial');
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ if (goog.DEBUG) {
|
||||
}
|
||||
|
||||
|
||||
var LONDON = ol.Projection.transformWithCodes(
|
||||
var LONDON = ol.projection.transformWithCodes(
|
||||
new ol.Coordinate(-0.12755, 51.507222), 'EPSG:4326', 'EPSG:3857');
|
||||
var MOSCOW = ol.Projection.transformWithCodes(
|
||||
var MOSCOW = ol.projection.transformWithCodes(
|
||||
new ol.Coordinate(37.6178, 55.7517), 'EPSG:4326', 'EPSG:3857');
|
||||
|
||||
var layer = new ol.layer.TileLayer({
|
||||
@@ -44,7 +44,7 @@ var domMap = new ol.Map({
|
||||
|
||||
var domMousePosition = new ol.control.MousePosition({
|
||||
coordinateFormat: ol.Coordinate.toStringHDMS,
|
||||
projection: ol.Projection.getFromCode('EPSG:4326'),
|
||||
projection: ol.projection.getFromCode('EPSG:4326'),
|
||||
target: document.getElementById('domMousePosition'),
|
||||
undefinedHTML: ' '
|
||||
});
|
||||
@@ -61,7 +61,7 @@ if (webglMap !== null) {
|
||||
|
||||
var webglMousePosition = new ol.control.MousePosition({
|
||||
coordinateFormat: ol.Coordinate.toStringHDMS,
|
||||
projection: ol.Projection.getFromCode('EPSG:4326'),
|
||||
projection: ol.projection.getFromCode('EPSG:4326'),
|
||||
target: document.getElementById('webglMousePosition'),
|
||||
undefinedHTML: ' '
|
||||
});
|
||||
@@ -78,7 +78,7 @@ if (canvasMap !== null) {
|
||||
|
||||
var canvasMousePosition = new ol.control.MousePosition({
|
||||
coordinateFormat: ol.Coordinate.toStringHDMS,
|
||||
projection: ol.Projection.getFromCode('EPSG:4326'),
|
||||
projection: ol.projection.getFromCode('EPSG:4326'),
|
||||
target: document.getElementById('canvasMousePosition'),
|
||||
undefinedHtml: ' '
|
||||
});
|
||||
|
||||
@@ -2,10 +2,10 @@ goog.require('ol.BingMapsStyle');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.Projection');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.BingMaps');
|
||||
goog.require('ol.source.TileJSON');
|
||||
|
||||
@@ -29,7 +29,7 @@ var webglMap = new ol.Map({
|
||||
renderer: ol.RendererHint.WEBGL,
|
||||
target: 'webglMap',
|
||||
view: new ol.View2D({
|
||||
center: ol.Projection.transformWithCodes(
|
||||
center: ol.projection.transformWithCodes(
|
||||
new ol.Coordinate(-77.93255, 37.9555), 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 5
|
||||
})
|
||||
|
||||
@@ -12,6 +12,7 @@ goog.require('ol.RendererHints');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.layer.ImageLayer');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.SingleImageWMS');
|
||||
goog.require('ol.source.TiledWMS');
|
||||
|
||||
@@ -24,7 +25,7 @@ if (goog.DEBUG) {
|
||||
var epsg21781 = new ol.Projection('EPSG:21781', ol.ProjectionUnits.METERS,
|
||||
// Validity extent from http://spatialreference.org
|
||||
new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864));
|
||||
ol.Projection.addProjection(epsg21781);
|
||||
ol.projection.addProjection(epsg21781);
|
||||
|
||||
// We give the single image source a set of resolutions. This prevents the
|
||||
// source from requesting images of arbitrary resolutions.
|
||||
|
||||
@@ -32,7 +32,7 @@ var layers = new ol.Collection([
|
||||
})
|
||||
]);
|
||||
var map = new ol.Map({
|
||||
renderer: ol.RendererHint.DOM,
|
||||
renderer: ol.RendererHint.CANVAS,
|
||||
layers: layers,
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
|
||||
Reference in New Issue
Block a user