Updated
This commit is contained in:
@@ -28,6 +28,12 @@
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div id="map" class="map"></div>
|
||||
|
||||
<select id="layer-select">
|
||||
<option value="Aerial">Aerial</option>
|
||||
<option value="AerialWithLabels" selected>Aerial with labels</option>
|
||||
<option value="Road">Road</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -46,6 +52,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="jquery.min.js" type="text/javascript"></script>
|
||||
<script src="loader.js?id=bing-maps" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
var map = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.TileLayer({
|
||||
source: new ol.source.BingMaps({
|
||||
key: 'AgtFlPYDnymLEe9zJ5PCkghbNiFZE9aAtTy3mPaEnEBXqLHtFuTcKoZ-miMC3w7R',
|
||||
style: 'AerialWithLabels'
|
||||
})
|
||||
var styles = ['Road', 'Aerial', 'AerialWithLabels'];
|
||||
var layers = [];
|
||||
for (var i = 0; i < styles.length; ++i) {
|
||||
layers.push(new ol.layer.TileLayer({
|
||||
visible: false,
|
||||
source: new ol.source.BingMaps({
|
||||
key: 'AgtFlPYDnymLEe9zJ5PCkghbNiFZE9aAtTy3mPaEnEBXqLHtFuTcKoZ-miMC3w7R',
|
||||
style: styles[i]
|
||||
})
|
||||
],
|
||||
}));
|
||||
}
|
||||
var map = new ol.Map({
|
||||
layers: layers,
|
||||
renderers: ol.RendererHints.createFromQueryData(),
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
@@ -15,3 +19,11 @@ var map = new ol.Map({
|
||||
zoom: 8
|
||||
})
|
||||
});
|
||||
|
||||
$('#layer-select').change(function() {
|
||||
var style = $(this).find(':selected').val();
|
||||
for (var i = 0; i < layers.length; ++i) {
|
||||
layers[i].setVisible(styles[i] == style);
|
||||
}
|
||||
});
|
||||
$('#layer-select').trigger('change');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.RendererHints');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.projection');
|
||||
|
||||
@@ -26,17 +26,8 @@
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<h4>Canvas</h4>
|
||||
<div id="canvasMap" class="map"></div>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<h4>WebGL</h4>
|
||||
<div id="webglMap" class="map"></div>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<h4>DOM</h4>
|
||||
<div id="domMap" class="map"></div>
|
||||
<div class="span12">
|
||||
<div id="map" class="map"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -53,6 +44,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="loader.js?id=canvas-tiles" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,38 +1,22 @@
|
||||
var layers = [
|
||||
new ol.layer.TileLayer({
|
||||
source: new ol.source.OpenStreetMap()
|
||||
}),
|
||||
new ol.layer.TileLayer({
|
||||
source: new ol.source.DebugTileSource({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: new ol.tilegrid.XYZ({
|
||||
maxZoom: 22
|
||||
var map = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.TileLayer({
|
||||
source: new ol.source.OpenStreetMap()
|
||||
}),
|
||||
new ol.layer.TileLayer({
|
||||
source: new ol.source.DebugTileSource({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: new ol.tilegrid.XYZ({
|
||||
maxZoom: 22
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
];
|
||||
|
||||
var webglMap = new ol.Map({
|
||||
],
|
||||
renderers: ol.RendererHints.createFromQueryData(),
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
center: ol.projection.transform(
|
||||
new ol.Coordinate(-0.1275, 51.507222), 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 10
|
||||
}),
|
||||
layers: layers,
|
||||
renderer: ol.RendererHint.WEBGL,
|
||||
target: 'webglMap'
|
||||
})
|
||||
});
|
||||
|
||||
var domMap = new ol.Map({
|
||||
renderer: ol.RendererHint.DOM,
|
||||
target: 'domMap'
|
||||
});
|
||||
domMap.bindTo('layers', webglMap);
|
||||
domMap.bindTo('view', webglMap);
|
||||
|
||||
var canvasMap = new ol.Map({
|
||||
renderer: ol.RendererHint.CANVAS,
|
||||
target: 'canvasMap'
|
||||
});
|
||||
canvasMap.bindTo('layers', webglMap);
|
||||
canvasMap.bindTo('view', webglMap);
|
||||
|
||||
@@ -6,5 +6,4 @@ goog.require('ol.control.ScaleLine');
|
||||
goog.require('ol.control.ScaleLineUnits');
|
||||
goog.require('ol.control.defaults');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.TiledWMS');
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -2,6 +2,5 @@ goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.RendererHints');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.control.defaults');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.source.MapQuestOpenAerial');
|
||||
|
||||
@@ -5,5 +5,4 @@ goog.require('ol.View2D');
|
||||
goog.require('ol.control.MousePosition');
|
||||
goog.require('ol.control.defaults');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.OpenStreetMap');
|
||||
|
||||
@@ -3,8 +3,6 @@ goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.animation');
|
||||
goog.require('ol.easing');
|
||||
goog.require('ol.interaction.Keyboard');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.projection');
|
||||
|
||||
15
master/examples/style-rules-require.js
Normal file
15
master/examples/style-rules-require.js
Normal file
@@ -0,0 +1,15 @@
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Expression');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.control.defaults');
|
||||
goog.require('ol.filter.Filter');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.parser.GeoJSON');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.Vector');
|
||||
goog.require('ol.style.Line');
|
||||
goog.require('ol.style.Rule');
|
||||
goog.require('ol.style.Style');
|
||||
52
master/examples/style-rules.html
Normal file
52
master/examples/style-rules.html
Normal file
@@ -0,0 +1,52 @@
|
||||
<!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="bootstrap/css/bootstrap.min.css" type="text/css">
|
||||
<link rel="stylesheet" href="examples.css" type="text/css">
|
||||
<link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||
<title>Style with rules example</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand" href="example-list.html">OpenLayers 3 Examples</a>
|
||||
<ul class="nav pull-right">
|
||||
<li><a href="https://github.com/openlayers/ol3"><i class="icon-github"></i></a></li>
|
||||
<li><a href="https://twitter.com/openlayers"><i class="icon-twitter"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div id="map" class="map"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<h4 id="title">Style with rules example</h4>
|
||||
<p id="shortdesc">Draws features with rule based styles.</p>
|
||||
<div id="docs">
|
||||
<p>See the <a href="style-rules.js" target="_blank">style-rules.js source</a> to see how this is done.</p>
|
||||
</div>
|
||||
<div id="tags">vector, geojson, style</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="loader.js?id=style-rules" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
117
master/examples/style-rules.js
Normal file
117
master/examples/style-rules.js
Normal file
@@ -0,0 +1,117 @@
|
||||
var style = new ol.style.Style({rules: [
|
||||
new ol.style.Rule({
|
||||
filter: new ol.filter.Filter(function(feature) {
|
||||
return feature.get('where') == 'outer';
|
||||
}),
|
||||
symbolizers: [
|
||||
new ol.style.Line({
|
||||
strokeColor: new ol.Expression('color'),
|
||||
strokeWidth: 4,
|
||||
opacity: 1
|
||||
})
|
||||
]
|
||||
}),
|
||||
new ol.style.Rule({
|
||||
filter: new ol.filter.Filter(function(feature) {
|
||||
return feature.get('where') == 'inner';
|
||||
}),
|
||||
symbolizers: [
|
||||
new ol.style.Line({
|
||||
strokeColor: '#013',
|
||||
strokeWidth: 4,
|
||||
opacity: 1
|
||||
}),
|
||||
new ol.style.Line({
|
||||
strokeColor: new ol.Expression('color'),
|
||||
strokeWidth: 2,
|
||||
opacity: 1
|
||||
})
|
||||
]
|
||||
})
|
||||
]});
|
||||
|
||||
var vector = new ol.layer.Vector({
|
||||
style: style,
|
||||
source: new ol.source.Vector({
|
||||
projection: ol.projection.get('EPSG:3857')
|
||||
})
|
||||
});
|
||||
|
||||
vector.parseFeatures({
|
||||
'type': 'FeatureCollection',
|
||||
'features': [{
|
||||
'type': 'Feature',
|
||||
'properties': {
|
||||
'color': '#BADA55',
|
||||
'where': 'inner'
|
||||
},
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-10000000, -10000000], [10000000, 10000000]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'properties': {
|
||||
'color': '#BADA55',
|
||||
'where': 'inner'
|
||||
},
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-10000000, 10000000], [10000000, -10000000]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'properties': {
|
||||
'color': '#013',
|
||||
'where': 'outer'
|
||||
},
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-10000000, -10000000], [-10000000, 10000000]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'properties': {
|
||||
'color': '#013',
|
||||
'where': 'outer'
|
||||
},
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-10000000, 10000000], [10000000, 10000000]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'properties': {
|
||||
'color': '#013',
|
||||
'where': 'outer'
|
||||
},
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[10000000, 10000000], [10000000, -10000000]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'properties': {
|
||||
'color': '#013',
|
||||
'where': 'outer'
|
||||
},
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[10000000, -10000000], [-10000000, -10000000]]
|
||||
}
|
||||
}]
|
||||
}, new ol.parser.GeoJSON(), ol.projection.get('EPSG:3857'));
|
||||
|
||||
|
||||
var map = new ol.Map({
|
||||
layers: [vector],
|
||||
controls: ol.control.defaults({
|
||||
attribution: false
|
||||
}),
|
||||
renderer: ol.RendererHint.CANVAS,
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
center: new ol.Coordinate(0, 0),
|
||||
zoom: 1
|
||||
})
|
||||
});
|
||||
14
master/examples/vector-layer-require.js
Normal file
14
master/examples/vector-layer-require.js
Normal file
@@ -0,0 +1,14 @@
|
||||
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.layer.Vector');
|
||||
goog.require('ol.parser.GeoJSON');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.MapQuestOpenAerial');
|
||||
goog.require('ol.source.Vector');
|
||||
goog.require('ol.style.Polygon');
|
||||
goog.require('ol.style.Rule');
|
||||
goog.require('ol.style.Style');
|
||||
52
master/examples/vector-layer.html
Normal file
52
master/examples/vector-layer.html
Normal file
@@ -0,0 +1,52 @@
|
||||
<!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="bootstrap/css/bootstrap.min.css" type="text/css">
|
||||
<link rel="stylesheet" href="examples.css" type="text/css">
|
||||
<link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||
<title>Vector layer example</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand" href="example-list.html">OpenLayers 3 Examples</a>
|
||||
<ul class="nav pull-right">
|
||||
<li><a href="https://github.com/openlayers/ol3"><i class="icon-github"></i></a></li>
|
||||
<li><a href="https://twitter.com/openlayers"><i class="icon-twitter"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div id="map" class="map"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<h4 id="title">Vector layer example</h4>
|
||||
<p id="shortdesc">Example of a vector layer.</p>
|
||||
<div id="docs">
|
||||
<p>See the <a href="vector-layer.js" target="_blank">vector-layer.js source</a> to see how this is done.</p>
|
||||
</div>
|
||||
<div id="tags">vector, geojson, style</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="loader.js?id=vector-layer" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
52
master/examples/vector-layer.js
Normal file
52
master/examples/vector-layer.js
Normal file
@@ -0,0 +1,52 @@
|
||||
var map;
|
||||
|
||||
var raster = new ol.layer.TileLayer({
|
||||
source: new ol.source.MapQuestOpenAerial()
|
||||
});
|
||||
|
||||
var vector = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
projection: ol.projection.get('EPSG:4326')
|
||||
}),
|
||||
style: new ol.style.Style({rules: [
|
||||
new ol.style.Rule({
|
||||
symbolizers: [
|
||||
new ol.style.Polygon({
|
||||
strokeStyle: '#696969',
|
||||
strokeWidth: 1,
|
||||
opacity: 1.5
|
||||
})
|
||||
]
|
||||
})
|
||||
]})
|
||||
});
|
||||
|
||||
var geojson = new ol.parser.GeoJSON();
|
||||
var url = '../test/spec/ol/parser/geojson/countries.json';
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url, true);
|
||||
|
||||
|
||||
/**
|
||||
* onload handler for the XHR request.
|
||||
*/
|
||||
xhr.onload = function() {
|
||||
if (xhr.status == 200) {
|
||||
// this is silly to have to tell the layer the destination projection
|
||||
var projection = map.getView().getProjection();
|
||||
vector.parseFeatures(xhr.responseText, geojson, projection);
|
||||
} else {
|
||||
throw new Error('Data loading failed: ' + xhr.status);
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
|
||||
map = new ol.Map({
|
||||
layers: new ol.Collection([raster, vector]),
|
||||
renderer: ol.RendererHint.CANVAS,
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
center: new ol.Coordinate(0, 0),
|
||||
zoom: 1
|
||||
})
|
||||
});
|
||||
@@ -2,10 +2,11 @@ goog.require('ol.Attribution');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.Projection');
|
||||
goog.require('ol.ProjectionUnits');
|
||||
goog.require('ol.RendererHints');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.control.ScaleLine');
|
||||
goog.require('ol.control.ScaleLineUnits');
|
||||
goog.require('ol.control.defaults');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.TiledWMS');
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.js" type="text/javascript"></script>
|
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/defs/EPSG21781.js" type="text/javascript"></script>
|
||||
<script src="loader.js?id=wms-custom-proj" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
var epsg21781 = new ol.Projection({
|
||||
var projection = ol.projection.configureProj4jsProjection({
|
||||
code: 'EPSG:21781',
|
||||
units: ol.ProjectionUnits.METERS,
|
||||
// Validity extent from http://spatialreference.org
|
||||
extent: new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864)
|
||||
});
|
||||
ol.projection.addProjection(epsg21781);
|
||||
|
||||
var extent = new ol.Extent(420000, 30000, 900000, 350000);
|
||||
var layers = [
|
||||
@@ -36,11 +33,16 @@ var layers = [
|
||||
];
|
||||
|
||||
var map = new ol.Map({
|
||||
controls: ol.control.defaults({}, [
|
||||
new ol.control.ScaleLine({
|
||||
units: ol.control.ScaleLineUnits.METRIC
|
||||
})
|
||||
]),
|
||||
layers: layers,
|
||||
renderers: ol.RendererHints.createFromQueryData(),
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
projection: epsg21781,
|
||||
projection: projection,
|
||||
center: new ol.Coordinate(660000, 190000),
|
||||
zoom: 2
|
||||
})
|
||||
|
||||
9
master/examples/wms-single-image-custom-proj-require.js
Normal file
9
master/examples/wms-single-image-custom-proj-require.js
Normal file
@@ -0,0 +1,9 @@
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.RendererHints');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.layer.ImageLayer');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.SingleImageWMS');
|
||||
54
master/examples/wms-single-image-custom-proj.html
Normal file
54
master/examples/wms-single-image-custom-proj.html
Normal file
@@ -0,0 +1,54 @@
|
||||
<!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="bootstrap/css/bootstrap.min.css" type="text/css">
|
||||
<link rel="stylesheet" href="examples.css" type="text/css">
|
||||
<link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||
<title>Single image WMS with custom projection example</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand" href="example-list.html">OpenLayers 3 Examples</a>
|
||||
<ul class="nav pull-right">
|
||||
<li><a href="https://github.com/openlayers/ol3"><i class="icon-github"></i></a></li>
|
||||
<li><a href="https://twitter.com/openlayers"><i class="icon-twitter"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div id="map" class="map"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<h4 id="title">Single image WMS with custom projection example</h4>
|
||||
<p id="shortdesc">Example of two single image WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.</p>
|
||||
<div id="docs">
|
||||
<p>See the <a href="wms-single-image-custom-proj.js" target="_blank">wms-single-image-custom-proj.js source</a> to see how this is done.</p>
|
||||
</div>
|
||||
<div id="tags">wms, single image, projection</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.js" type="text/javascript"></script>
|
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/defs/EPSG21781.js" type="text/javascript"></script>
|
||||
<script src="loader.js?id=wms-single-image-custom-proj" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
44
master/examples/wms-single-image-custom-proj.js
Normal file
44
master/examples/wms-single-image-custom-proj.js
Normal file
@@ -0,0 +1,44 @@
|
||||
var projection = ol.projection.configureProj4jsProjection({
|
||||
code: 'EPSG:21781',
|
||||
extent: new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864)
|
||||
});
|
||||
|
||||
var extent = new ol.Extent(420000, 30000, 900000, 350000);
|
||||
var layers = [
|
||||
new ol.layer.ImageLayer({
|
||||
source: new ol.source.SingleImageWMS({
|
||||
url: 'http://wms.geo.admin.ch/',
|
||||
attributions: [new ol.Attribution(
|
||||
'© ' +
|
||||
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +
|
||||
'Pixelmap 1:1000000 / geo.admin.ch</a>')],
|
||||
params: {
|
||||
'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
|
||||
'FORMAT': 'image/jpeg'
|
||||
},
|
||||
extent: extent
|
||||
})
|
||||
}),
|
||||
new ol.layer.ImageLayer({
|
||||
source: new ol.source.SingleImageWMS({
|
||||
url: 'http://wms.geo.admin.ch/',
|
||||
attributions: [new ol.Attribution(
|
||||
'© ' +
|
||||
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +
|
||||
'National parks / geo.admin.ch</a>')],
|
||||
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
|
||||
extent: extent
|
||||
})
|
||||
})
|
||||
];
|
||||
|
||||
var map = new ol.Map({
|
||||
layers: layers,
|
||||
renderers: ol.RendererHints.createFromQueryData(),
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
projection: projection,
|
||||
center: new ol.Coordinate(660000, 190000),
|
||||
zoom: 2
|
||||
})
|
||||
});
|
||||
@@ -4,9 +4,9 @@ var layers = [
|
||||
}),
|
||||
new ol.layer.ImageLayer({
|
||||
source: new ol.source.SingleImageWMS({
|
||||
url: 'http://demo.opengeo.org/geoserver/wms',
|
||||
url: 'http://suite.opengeo.org/geoserver/wms',
|
||||
crossOrigin: null,
|
||||
params: {'LAYERS': 'topp:states'},
|
||||
params: {'LAYERS': 'usa:states'},
|
||||
extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,9 +4,9 @@ var layers = [
|
||||
}),
|
||||
new ol.layer.TileLayer({
|
||||
source: new ol.source.TiledWMS({
|
||||
url: 'http://demo.opengeo.org/geoserver/wms',
|
||||
url: 'http://suite.opengeo.org/geoserver/wms',
|
||||
crossOrigin: null,
|
||||
params: {'LAYERS': 'topp:states', 'TILED': true},
|
||||
params: {'LAYERS': 'usa:states', 'TILED': true},
|
||||
extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219)
|
||||
})
|
||||
})
|
||||
|
||||
6
master/examples/zoomslider-require.js
Normal file
6
master/examples/zoomslider-require.js
Normal file
@@ -0,0 +1,6 @@
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.control.ZoomSlider');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.source.MapQuestOpenAerial');
|
||||
115
master/examples/zoomslider.html
Normal file
115
master/examples/zoomslider.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<!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="bootstrap/css/bootstrap.min.css" type="text/css">
|
||||
<link rel="stylesheet" href="examples.css" type="text/css">
|
||||
<link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||
<style type="text/css">
|
||||
/**
|
||||
* The zoomslider in the second map shall be placed between the zoom-in and
|
||||
* zoom-out buttons.
|
||||
*/
|
||||
#map2 .ol-zoom a.ol-zoom-out {
|
||||
margin-top: 202px;
|
||||
}
|
||||
#map2 .ol-zoomslider {
|
||||
background-color: transparent;
|
||||
top: 34px;
|
||||
left: 9px;
|
||||
width: 24px;
|
||||
}
|
||||
#map2 .ol-zoomslider-thumb {
|
||||
border-radius: 2px;
|
||||
width: 24px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
/**
|
||||
* The zoomslider in the third map shall be horizontal, placed in the top-right
|
||||
* corner, smaller and orange.
|
||||
*/
|
||||
#map3 .ol-zoomslider {
|
||||
top: 8px;
|
||||
left: auto;
|
||||
right: 8px;
|
||||
background-color: rgba(255,69,0,0.2);
|
||||
width: 200px;
|
||||
height: 15px;
|
||||
padding: 0;
|
||||
box-shadow: 0 0 5px rgb(255,69,0);
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
#map3 .ol-zoomslider:hover {
|
||||
background-color: rgba(255,69,0,0.3);
|
||||
}
|
||||
|
||||
#map3 .ol-zoomslider-thumb {
|
||||
height: 15px;
|
||||
width: 15px;
|
||||
margin: 0;
|
||||
filter: none;
|
||||
background-color: rgba(255,69,0,0.6);
|
||||
border-radius: 20px;
|
||||
}
|
||||
#map3 a.ol-zoomslider-handle:hover {
|
||||
background-color: rgba(255,69,0,0.7);
|
||||
}
|
||||
</style>
|
||||
<title>ol3 ZoomSlider demo</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand" href="example-list.html">OpenLayers 3 Examples</a>
|
||||
<ul class="nav pull-right">
|
||||
<li><a href="https://github.com/openlayers/ol3"><i class="icon-github"></i></a></li>
|
||||
<li><a href="https://twitter.com/openlayers"><i class="icon-twitter"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<h4>Default style</h4>
|
||||
<div id="map1" class="map"></div>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<h4>Placed between zoom controls</h4>
|
||||
<div id="map2" class="map"></div>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<h4>Horizontal and completely re-styled</h4>
|
||||
<div id="map3" class="map"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<h4 id="title">ZoomSlider control</h4>
|
||||
<p id="shortdesc">Example of various ZoomSlider controls.</p>
|
||||
<div id="docs">
|
||||
<p>
|
||||
See the <a href="zoomslider.js" target="_blank">zoomslider.js
|
||||
source</a> to see how this is done.
|
||||
</p>
|
||||
</div>
|
||||
<div id="tags">
|
||||
zoom, zoomslider, slider, style, styling, css, control
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="loader.js?id=zoomslider" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
35
master/examples/zoomslider.js
Normal file
35
master/examples/zoomslider.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Helper method for map-creation.
|
||||
*
|
||||
* @param {string} divId The id of the div for the map.
|
||||
* @return {ol.Map} The ol.Map instance.
|
||||
*/
|
||||
var createMap = function(divId) {
|
||||
var source, layer, map, zoomslider, resolutions, minRes, maxRes;
|
||||
|
||||
source = new ol.source.MapQuestOpenAerial();
|
||||
// These are the min and max resolutions of MapQuestOpenAerial
|
||||
minRes = 0.5971642834779395;
|
||||
maxRes = 156543.03392804097;
|
||||
layer = new ol.layer.TileLayer({
|
||||
source: source
|
||||
});
|
||||
map = new ol.Map({
|
||||
layers: [layer],
|
||||
target: divId,
|
||||
view: new ol.View2D({
|
||||
center: new ol.Coordinate(0, 0),
|
||||
zoom: 2
|
||||
})
|
||||
});
|
||||
zoomslider = new ol.control.ZoomSlider({
|
||||
minResolution: minRes,
|
||||
maxResolution: maxRes,
|
||||
map: map
|
||||
});
|
||||
return map;
|
||||
};
|
||||
|
||||
var map1 = createMap('map1');
|
||||
var map2 = createMap('map2');
|
||||
var map3 = createMap('map3');
|
||||
Reference in New Issue
Block a user