This commit is contained in:
Tom Payne
2013-03-11 16:47:39 +01:00
parent f150259eee
commit 9b734a3335
150 changed files with 8832 additions and 4380 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
goog.require('ol.AnchoredElement');
goog.require('ol.Coordinate');
goog.require('ol.Geolocation');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.OpenStreetMap');
+61
View File
@@ -0,0 +1,61 @@
<!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>
.icon-flag {
font-size: 22px;
text-shadow: 2px 2px 3px #013;
}
</style>
<title>Geolocation 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">Geolocation example</h4>
<p id="shortdesc">Example of a geolocation map.</p>
<div id="docs">
<p>See the <a href="geolocation.js" target="_blank">geolocation.js source</a> to see how this is done.</p>
</div>
<button id="locate"><i class="icon-screenshot"></i> locate</button>
<div id="tags">geolocation, openstreetmap</div>
</div>
</div>
</div>
<script src="jquery.min.js" type="text/javascript"></script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="loader.js?id=geolocation" type="text/javascript"></script>
</body>
</html>
+33
View File
@@ -0,0 +1,33 @@
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
source: new ol.source.OpenStreetMap()
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: new ol.Coordinate(0, 0),
zoom: 2
})
});
var geolocation = new ol.Geolocation();
geolocation.bindTo('projection', map.getView());
var marker = new ol.AnchoredElement({
map: map,
element: /** @type {Element} */ ($('<i/>').addClass('icon-flag').get(0))
});
// bind the marker position to the device location.
marker.bindTo('position', geolocation);
geolocation.addEventListener('accuracy_changed', function() {
$(marker.getElement()).tooltip({
title: this.getAccuracy() + 'm from this point'
});
});
$('#locate').click(function() {
geolocation.setTracking(true);
});
@@ -0,0 +1,9 @@
goog.require('ol.Coordinate');
goog.require('ol.Extent');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.parser.ogc.WMTSCapabilities');
goog.require('ol.projection');
goog.require('ol.source.WMTS');
@@ -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>WMTS from capabilities 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">WMTS from capabilities example</h4>
<p id="shortdesc">Example of a WMTS source built from a WMTS getCapabilities response.</p>
<div id="docs">
<p>See the <a href="wmts-from-capabilities.js" target="_blank">wmts-from-capabilities.js source</a> to see how this is done.</p>
</div>
<div id="tags">wmts</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=wmts-from-capabilities" type="text/javascript"></script>
</body>
</html>
+36
View File
@@ -0,0 +1,36 @@
var map, capabilities;
var parser = new ol.parser.ogc.WMTSCapabilities();
var projection = ol.projection.configureProj4jsProjection({
code: 'EPSG:21781',
extent: new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864)
});
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://wmts.geo.admin.ch/1.0.0/WMTSCapabilities.xml', true);
/**
* onload handler for the XHR request.
*/
xhr.onload = function() {
if (xhr.status == 200) {
capabilities = parser.read(xhr.responseXML);
var wmtsOptions = ol.source.WMTS.optionsFromCapabilities(
capabilities, 'ch.swisstopo.pixelkarte-farbe');
map = new ol.Map({
layers: [
new ol.layer.TileLayer({
source: new ol.source.WMTS(wmtsOptions)
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: projection.getExtent().getCenter(),
projection: projection,
zoom: 1
})
});
}
};
xhr.send();
+10
View File
@@ -0,0 +1,10 @@
goog.require('ol.Coordinate');
goog.require('ol.Extent');
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.OpenStreetMap');
goog.require('ol.source.WMTS');
goog.require('ol.tilegrid.WMTS');
+52
View 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>WMTS 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">WMTS example</h4>
<p id="shortdesc">Example of a WMTS source.</p>
<div id="docs">
<p>See the <a href="wmts.js" target="_blank">wmts.js source</a> to see how this is done.</p>
</div>
<div id="tags">wmts</div>
</div>
</div>
</div>
<script src="loader.js?id=wmts" type="text/javascript"></script>
</body>
</html>
+42
View File
@@ -0,0 +1,42 @@
var projection = ol.projection.get('EPSG:900913');
var projectionExtent = projection.getExtent();
var size = projectionExtent.getWidth() / 256;
var resolutions = new Array(26);
var matrixIds = new Array(26);
for (var z = 0; z < 26; ++z) {
// generate resolutions and matrixIds arrays for this WMTS
resolutions[z] = size / Math.pow(2, z);
matrixIds[z] = 'EPSG:900913:' + z;
}
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
source: new ol.source.OpenStreetMap(),
opacity: 0.7
}),
new ol.layer.TileLayer({
source: new ol.source.WMTS({
url: 'http://v2.suite.opengeo.org/geoserver/gwc/service/wmts/',
layer: 'medford:buildings',
matrixSet: 'EPSG:900913',
format: 'image/png',
projection: projection,
tileGrid: new ol.tilegrid.WMTS({
origin: projectionExtent.getTopLeft(),
resolutions: resolutions,
matrixIds: matrixIds
}),
style: '_null',
crossOrigin: null, // FIXME: this should be the default
extent: new ol.Extent(-13682835, 5204068, -13667473, 5221690)
})
})
],
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
center: new ol.Coordinate(-13677832, 5213272),
zoom: 13
})
});