This commit is contained in:
Éric Lemoine
2013-03-03 20:46:05 +01:00
parent 5d14b9e2d4
commit 13db9a5038
129 changed files with 19764 additions and 3406 deletions

View File

@@ -1,23 +1,14 @@
goog.require('goog.debug.Console');
goog.require('goog.debug.Logger');
goog.require('goog.debug.Logger.Level');
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');
if (goog.DEBUG) {
goog.debug.Console.autoInstall();
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
}
var layer = new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
});
@@ -35,7 +26,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 +40,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);
});

View File

@@ -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
}),

View File

@@ -0,0 +1,284 @@
<?xml version='1.0' encoding="UTF-8"?>
<WMS_Capabilities version="1.3.0" xmlns="http://www.opengis.net/wms"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd">
<Service>
<Name>WMS</Name>
<Title>Acme Corp. Map Server</Title>
<Abstract>Map Server maintained by Acme Corporation. Contact: webmaster@wmt.acme.com. High-quality maps showing roadrunner nests and possible ambush locations.</Abstract>
<KeywordList>
<Keyword>bird</Keyword>
<Keyword>roadrunner</Keyword>
<Keyword>ambush</Keyword>
</KeywordList>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple"
xlink:href="http://hostname/" />
<ContactInformation>
<ContactPersonPrimary>
<ContactPerson>Jeff Smith</ContactPerson>
<ContactOrganization>NASA</ContactOrganization>
</ContactPersonPrimary>
<ContactPosition>Computer Scientist</ContactPosition>
<ContactAddress>
<AddressType>postal</AddressType>
<Address>NASA Goddard Space Flight Center</Address>
<City>Greenbelt</City>
<StateOrProvince>MD</StateOrProvince>
<PostCode>20771</PostCode>
<Country>USA</Country>
</ContactAddress>
<ContactVoiceTelephone>+1 301 555-1212</ContactVoiceTelephone>
<ContactElectronicMailAddress>user@host.com</ContactElectronicMailAddress>
</ContactInformation>
<Fees>none</Fees>
<AccessConstraints>none</AccessConstraints>
<LayerLimit>16</LayerLimit>
<MaxWidth>2048</MaxWidth>
<MaxHeight>2048</MaxHeight>
</Service>
<Capability>
<Request>
<GetCapabilities>
<Format>text/xml</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://hostname/path?" />
</Get>
<Post>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://hostname/path?" />
</Post>
</HTTP>
</DCPType>
</GetCapabilities>
<GetMap>
<Format>image/gif</Format>
<Format>image/png</Format>
<Format>image/jpeg</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://hostname/path?" />
</Get>
</HTTP>
</DCPType>
</GetMap>
<GetFeatureInfo>
<Format>text/xml</Format>
<Format>text/plain</Format>
<Format>text/html</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://hostname/path?" />
</Get>
</HTTP>
</DCPType>
</GetFeatureInfo>
</Request>
<Exception>
<Format>XML</Format>
<Format>INIMAGE</Format>
<Format>BLANK</Format>
</Exception>
<Layer>
<Title>Acme Corp. Map Server</Title>
<CRS>CRS:84</CRS>
<AuthorityURL name="DIF_ID">
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple"
xlink:href="http://gcmd.gsfc.nasa.gov/difguide/whatisadif.html" />
</AuthorityURL>
<BoundingBox CRS="CRS:84"
minx="-1" miny="-1" maxx="1" maxy="1" resx="0.0" resy="0.0"/>
<Layer>
<Name>ROADS_RIVERS</Name>
<Title>Roads and Rivers</Title>
<CRS>EPSG:26986</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>-71.63</westBoundLongitude>
<eastBoundLongitude>-70.78</eastBoundLongitude>
<southBoundLatitude>41.75</southBoundLatitude>
<northBoundLatitude>42.90</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox CRS="CRS:84"
minx="-71.63" miny="41.75" maxx="-70.78" maxy="42.90" resx="0.01" resy="0.01"/>
<BoundingBox CRS="EPSG:26986"
minx="189000" miny="834000" maxx="285000" maxy="962000" resx="1" resy="1" />
<Attribution>
<Title>State College University</Title>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple"
xlink:href="http://www.university.edu/" />
<LogoURL width="100" height="100">
<Format>image/gif</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://www.university.edu/icons/logo.gif" />
</LogoURL>
</Attribution>
<Identifier authority="DIF_ID">123456</Identifier>
<FeatureListURL>
<Format>XML</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple"
xlink:href="http://www.university.edu/data/roads_rivers.gml" />
</FeatureListURL>
<Style>
<Name>USGS</Name>
<Title>USGS Topo Map Style</Title>
<Abstract>Features are shown in a style like that used in USGS topographic maps.</Abstract>
<LegendURL width="72" height="72">
<Format>image/gif</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://www.university.edu/legends/usgs.gif" />
</LegendURL>
<StyleSheetURL>
<Format>text/xsl</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://www.university.edu/stylesheets/usgs.xsl" />
</StyleSheetURL>
</Style>
<MinScaleDenominator>1000</MinScaleDenominator>
<MaxScaleDenominator>250000</MaxScaleDenominator>
<Layer queryable="1">
<Name>ROADS_1M</Name>
<Title>Roads at 1:1M scale</Title>
<Abstract>Roads at a scale of 1 to 1 million.</Abstract>
<KeywordList>
<Keyword>road</Keyword>
<Keyword>transportation</Keyword>
<Keyword>atlas</Keyword>
</KeywordList>
<Identifier authority="DIF_ID">123456</Identifier>
<MetadataURL type="FGDC:1998">
<Format>text/plain</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://www.university.edu/metadata/roads.txt" />
</MetadataURL>
<MetadataURL type="ISO19115:2003">
<Format>text/xml</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://www.university.edu/metadata/roads.xml" />
</MetadataURL>
<Style>
<Name>ATLAS</Name>
<Title>Road atlas style</Title>
<Abstract>Roads are shown in a style like that used in a commercial road atlas.</Abstract>
<LegendURL width="72" height="72">
<Format>image/gif</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://www.university.edu/legends/atlas.gif" />
</LegendURL>
</Style>
</Layer>
<Layer queryable="1">
<Name>RIVERS_1M</Name>
<Title>Rivers at 1:1M scale</Title>
<Abstract>Rivers at a scale of 1 to 1 million.</Abstract>
<KeywordList>
<Keyword>river</Keyword>
<Keyword>canal</Keyword>
<Keyword>waterway</Keyword>
</KeywordList>
</Layer>
</Layer>
<Layer queryable="1">
<Title>Weather Forecast Data</Title>
<CRS>CRS:84</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>-180</westBoundLongitude>
<eastBoundLongitude>180</eastBoundLongitude>
<southBoundLatitude>-90</southBoundLatitude>
<northBoundLatitude>90</northBoundLatitude>
</EX_GeographicBoundingBox>
<Dimension name="time" units="ISO8601" default="2000-08-22">1999-01-01/2000-08-22/P1D</Dimension>
<Layer>
<Name>Clouds</Name>
<Title>Forecast cloud cover</Title>
</Layer>
<Layer>
<Name>Temperature</Name>
<Title>Forecast temperature</Title>
</Layer>
<Layer>
<Name>Pressure</Name>
<Title>Forecast barometric pressure</Title>
<Dimension name="elevation" units="EPSG:5030" />
<Dimension name="time" units="ISO8601" default="2000-08-22">
1999-01-01/2000-08-22/P1D</Dimension>
<Dimension name="elevation" units="CRS:88" default="0" nearestValue="1">0,1000,3000,5000,10000</Dimension>
</Layer>
</Layer>
<Layer opaque="1" noSubsets="1" fixedWidth="512" fixedHeight="256">
<Name>ozone_image</Name>
<Title>Global ozone distribution (1992)</Title>
<EX_GeographicBoundingBox>
<westBoundLongitude>-180</westBoundLongitude>
<eastBoundLongitude>180</eastBoundLongitude>
<southBoundLatitude>-90</southBoundLatitude>
<northBoundLatitude>90</northBoundLatitude>
</EX_GeographicBoundingBox>
<Dimension name="time" units="ISO8601" default="1992">1992</Dimension>
</Layer>
<Layer cascaded="1">
<Name>population</Name>
<Title>World population, annual</Title>
<EX_GeographicBoundingBox>
<westBoundLongitude>-180</westBoundLongitude>
<eastBoundLongitude>180</eastBoundLongitude>
<southBoundLatitude>-90</southBoundLatitude>
<northBoundLatitude>90</northBoundLatitude>
</EX_GeographicBoundingBox>
<Dimension name="time" units="ISO8601" default="2000">1990/2000/P1Y</Dimension>
</Layer>
</Layer>
</Capability>
</WMS_Capabilities>

View 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>

View 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
})
});

View File

@@ -1 +1 @@
var info={"index": {"origin": {"1": 2}, "and": {"3": 1, "4": 1, "6": 1}, "layer": {"4": 1, "7": 1}, "projection": {"6": 3}, "capabilities": {"5": 1}, "ed": {"3": 1, "4": 1}, "national": {"6": 1}, "sync": {"3": 2, "4": 1}, "21781": {"6": 1}, "an": {"1": 1}, "openaerial": {"0": 1, "2": 1}, "tilelayer": {"2": 1, "6": 1, "7": 1}, "popup": {"0": 1}, "osm": {"1": 1}, "are": {"1": 2}, "mapquest": {"0": 1, "2": 1}, "1": {"6": 2}, "getcapabilities": {"5": 3}, "tiled": {"6": 2, "7": 2}, "webgl": {"3": 2, "4": 1}, "layers": {"1": 1, "4": 2, "6": 1}, "fullscreen": {"2": 1}, "canvas": {"1": 3, "3": 1, "4": 1}, "overlay": {"0": 1}, "wms": {"5": 3, "6": 3, "7": 3}, "demonstrates": {"0": 1}, "top": {"1": 1}, "custom": {"6": 1}, "two": {"4": 2, "6": 1}, "coordinates": {"1": 3}, "response": {"5": 1}, "note": {"1": 1}, "maps": {"3": 1, "4": 1}, "pixelmap": {"6": 1}, "black": {"1": 1}, "tile": {"1": 3, "2": 1, "6": 1, "7": 1}, "parks": {"6": 1}, "stamen": {"1": 1}, "map": {"2": 1}, "tiles": {"1": 2}, "elements": {"0": 3}, "that": {"1": 1}, "screen": {"2": 2}, "object": {"3": 1}, "generated": {"1": 1}, "ol3": {"1": 1}, "grid": {"1": 1}, "html5": {"1": 1}, "not": {"1": 1}, "using": {"6": 1}, "tilejson": {"4": 1}, "on": {"1": 1}, "with": {"1": 1, "4": 1, "6": 1}, "by": {"3": 3}, "bingmaps": {"4": 1}, "a": {"2": 1, "5": 1, "7": 1}, "anchored": {"0": 3}, "full": {"2": 2}, "dom": {"3": 2, "4": 1}, "of": {"2": 1, "5": 1, "6": 1, "7": 1}, "bing": {"4": 1}, "bottom": {"1": 1}, "000": {"6": 2}, "side": {"3": 6}, "parsing": {"5": 2}, "client": {"1": 1}, "epsg": {"6": 1}, "the": {"1": 3, "6": 1}, "left": {"1": 2}, "example": {"0": 1, "1": 1, "2": 2, "3": 1, "4": 1, "5": 2, "6": 2, "7": 2}, "normalized": {"1": 1}}, "examples": [{"author": "Tom Payne", "tags": "anchored elements, overlay, popup, mapquest, openaerial", "modified": "2013-01-22T14:37:13+0100", "classes": [], "link": "anchored-elements.html", "shortdesc": "Demonstrates anchored elements.", "title": "Anchored elements example", "example": "anchored-elements.html"}, {"author": "Tom Payne", "tags": "layers, stamen, canvas", "modified": "2013-01-05T18:33:37+0100", "classes": [], "link": "canvas-tiles.html", "shortdesc": "The black grid tiles are generated on the client with an HTML5 canvas. Note that the tile coordinates are ol3 normalized tile coordinates (origin bottom left), not OSM tile coordinates (origin top left).", "title": "Canvas tiles example", "example": "canvas-tiles.html"}, {"author": "Frederic Junod", "tags": "fullscreen, mapquest, openaerial, tile, tilelayer", "modified": "2013-02-04T10:52:29+0100", "classes": [], "link": "full-screen.html", "shortdesc": "Example of a full-screen map.", "title": "Full-screen example", "example": "full-screen.html"}, {"author": "Tom Payne", "tags": "side-by-side, webgl, dom, sync, object", "modified": "2013-01-18T14:04:33+0100", "classes": [], "link": "side-by-side.html", "shortdesc": "Side-by-side DOM, WebGL and Canvas sync'ed maps.", "title": "Side-by-side example", "example": "side-by-side.html"}, {"author": "Frederic Junod", "tags": "layers, tilejson, bing, bingmaps", "modified": "2013-01-21T16:13:19+0100", "classes": [], "link": "two-layers.html", "shortdesc": "Sync'ed DOM, WebGL and Canvas maps with two layers.", "title": "Two-layer example", "example": "two-layers.html"}, {"author": "Bart van den Eijnden", "tags": "wms, capabilities, getcapabilities", "modified": "2013-02-07T10:45:35+0100", "classes": [], "link": "wms-capabilities.html", "shortdesc": "Example of parsing a WMS GetCapabilities response.", "title": "WMS GetCapabilities parsing example", "example": "wms-capabilities.html"}, {"author": "ahocevar", "tags": "wms, tile, tilelayer, projection", "modified": "2012-10-29T09:33:00+0100", "classes": [], "link": "wms-custom-proj.html", "shortdesc": "Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.", "title": "Tiled WMS with custom projection example", "example": "wms-custom-proj.html"}, {"author": "ahocevar", "tags": "wms, tile, tilelayer", "modified": "2012-10-26T21:36:30+0200", "classes": [], "link": "wms.html", "shortdesc": "Example of a tiled WMS layer.", "title": "Tiled WMS example", "example": "wms.html"}]};
var info={"index": {"origin": {"1": 2}, "and": {"4": 1, "5": 1, "7": 1}, "layer": {"8": 1, "5": 1}, "projection": {"7": 3}, "capabilities": {"6": 1}, "ed": {"4": 1, "5": 1}, "national": {"7": 1}, "4326": {"2": 2}, "sync": {"4": 2, "5": 1}, "21781": {"7": 1}, "an": {"1": 1}, "openaerial": {"0": 1, "3": 1}, "tilelayer": {"8": 1, "3": 1, "7": 1}, "popup": {"0": 1}, "osm": {"1": 1}, "are": {"1": 2}, "mapquest": {"0": 1, "3": 1}, "1": {"7": 2}, "getcapabilities": {"6": 3}, "tilejson": {"5": 1}, "tiled": {"8": 2, "7": 2}, "webgl": {"4": 2, "5": 1}, "layers": {"1": 1, "5": 2, "7": 1}, "fullscreen": {"3": 1}, "canvas": {"1": 3, "4": 1, "5": 1}, "overlay": {"0": 1}, "wms": {"8": 3, "6": 3, "7": 3}, "demonstrates": {"0": 1}, "top": {"1": 1}, "custom": {"7": 1}, "two": {"5": 2, "7": 1}, "coordinates": {"1": 3}, "response": {"6": 1}, "note": {"1": 1}, "maps": {"4": 1, "5": 1}, "pixelmap": {"7": 1}, "black": {"1": 1}, "tile": {"8": 1, "1": 3, "3": 1, "7": 1}, "parks": {"7": 1}, "stamen": {"1": 1}, "map": {"2": 1, "3": 1}, "tiles": {"1": 2}, "elements": {"0": 3}, "that": {"1": 1}, "screen": {"3": 2}, "object": {"4": 1}, "generated": {"1": 1}, "ol3": {"1": 1}, "grid": {"1": 1}, "html5": {"1": 1}, "not": {"1": 1}, "using": {"7": 1}, "epsg4326": {"2": 1}, "on": {"1": 1}, "with": {"1": 1, "5": 1, "7": 1}, "by": {"4": 3}, "bingmaps": {"5": 1}, "a": {"8": 1, "2": 1, "3": 1, "6": 1}, "anchored": {"0": 3}, "full": {"3": 2}, "dom": {"4": 2, "5": 1}, "of": {"8": 1, "2": 1, "3": 1, "6": 1, "7": 1}, "bing": {"5": 1}, "bottom": {"1": 1}, "000": {"7": 2}, "side": {"4": 6}, "parsing": {"6": 2}, "client": {"1": 1}, "epsg": {"2": 2, "7": 1}, "the": {"1": 3, "7": 1}, "left": {"1": 2}, "example": {"0": 1, "1": 1, "2": 2, "3": 2, "4": 1, "5": 1, "6": 2, "7": 2, "8": 2}, "normalized": {"1": 1}}, "examples": [{"author": "Tom Payne", "tags": "anchored elements, overlay, popup, mapquest, openaerial", "modified": "2013-01-22T14:37:13+0100", "classes": [], "link": "anchored-elements.html", "shortdesc": "Demonstrates anchored elements.", "title": "Anchored elements example", "example": "anchored-elements.html"}, {"author": "Tom Payne", "tags": "layers, stamen, canvas", "modified": "2013-01-05T18:33:37+0100", "classes": [], "link": "canvas-tiles.html", "shortdesc": "The black grid tiles are generated on the client with an HTML5 canvas. Note that the tile coordinates are ol3 normalized tile coordinates (origin bottom left), not OSM tile coordinates (origin top left).", "title": "Canvas tiles example", "example": "canvas-tiles.html"}, {"author": "Tom Payne", "tags": "epsg4326", "modified": "2013-02-21T20:22:46+0100", "classes": [], "link": "epsg-4326.html", "shortdesc": "Example of a epsg-4326 map.", "title": "EPSG:4326 example", "example": "epsg-4326.html"}, {"author": "Frederic Junod", "tags": "fullscreen, mapquest, openaerial, tile, tilelayer", "modified": "2013-02-04T10:52:29+0100", "classes": [], "link": "full-screen.html", "shortdesc": "Example of a full-screen map.", "title": "Full-screen example", "example": "full-screen.html"}, {"author": "Tom Payne", "tags": "side-by-side, webgl, dom, sync, object", "modified": "2013-01-18T14:04:33+0100", "classes": [], "link": "side-by-side.html", "shortdesc": "Side-by-side DOM, WebGL and Canvas sync'ed maps.", "title": "Side-by-side example", "example": "side-by-side.html"}, {"author": "Frederic Junod", "tags": "layers, tilejson, bing, bingmaps", "modified": "2013-01-21T16:13:19+0100", "classes": [], "link": "two-layers.html", "shortdesc": "Sync'ed DOM, WebGL and Canvas maps with two layers.", "title": "Two-layer example", "example": "two-layers.html"}, {"author": "Bruno Binet", "tags": "wms, capabilities, getcapabilities", "modified": "2013-03-03T17:37:15+0100", "classes": [], "link": "wms-capabilities.html", "shortdesc": "Example of parsing a WMS GetCapabilities response.", "title": "WMS GetCapabilities parsing example", "example": "wms-capabilities.html"}, {"author": "ahocevar", "tags": "wms, tile, tilelayer, projection", "modified": "2012-10-29T09:33:00+0100", "classes": [], "link": "wms-custom-proj.html", "shortdesc": "Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.", "title": "Tiled WMS with custom projection example", "example": "wms-custom-proj.html"}, {"author": "ahocevar", "tags": "wms, tile, tilelayer", "modified": "2012-10-26T21:36:30+0200", "classes": [], "link": "wms.html", "shortdesc": "Example of a tiled WMS layer.", "title": "Tiled WMS example", "example": "wms.html"}]};

View File

@@ -1 +1 @@
<?xml version="1.0" ?><feed xmlns="http://www.w3.org/2005/Atom"><title>OpenLayers Examples</title><id>http://openlayers.github.com/ol3/master/examples/example-list.xml#2013-02-20T09:36:53Z</id><updated>2013-02-20T09:36:53Z</updated><entry><title>WMS GetCapabilities parsing example</title><tags>wms, capabilities, getcapabilities</tags><link href="http://openlayers.github.com/ol3/master/examples/wms-capabilities.html"/><summary>Example of parsing a WMS GetCapabilities response.</summary><updated>2013-02-07T10:45:35+0100</updated><author><name>Bart van den Eijnden</name></author><id>http://openlayers.github.com/ol3/master/examples/wms-capabilities.html#2013-02-07T10:45:35+0100</id></entry><entry><title>Full-screen example</title><tags>fullscreen, mapquest, openaerial, tile, tilelayer</tags><link href="http://openlayers.github.com/ol3/master/examples/full-screen.html"/><summary>Example of a full-screen map.</summary><updated>2013-02-04T10:52:29+0100</updated><author><name>Frederic Junod</name></author><id>http://openlayers.github.com/ol3/master/examples/full-screen.html#2013-02-04T10:52:29+0100</id></entry><entry><title>Anchored elements example</title><tags>anchored elements, overlay, popup, mapquest, openaerial</tags><link href="http://openlayers.github.com/ol3/master/examples/anchored-elements.html"/><summary>Demonstrates anchored elements.</summary><updated>2013-01-22T14:37:13+0100</updated><author><name>Tom Payne</name></author><id>http://openlayers.github.com/ol3/master/examples/anchored-elements.html#2013-01-22T14:37:13+0100</id></entry><entry><title>Two-layer example</title><tags>layers, tilejson, bing, bingmaps</tags><link href="http://openlayers.github.com/ol3/master/examples/two-layers.html"/><summary>Sync'ed DOM, WebGL and Canvas maps with two layers.</summary><updated>2013-01-21T16:13:19+0100</updated><author><name>Frederic Junod</name></author><id>http://openlayers.github.com/ol3/master/examples/two-layers.html#2013-01-21T16:13:19+0100</id></entry><entry><title>Side-by-side example</title><tags>side-by-side, webgl, dom, sync, object</tags><link href="http://openlayers.github.com/ol3/master/examples/side-by-side.html"/><summary>Side-by-side DOM, WebGL and Canvas sync'ed maps.</summary><updated>2013-01-18T14:04:33+0100</updated><author><name>Tom Payne</name></author><id>http://openlayers.github.com/ol3/master/examples/side-by-side.html#2013-01-18T14:04:33+0100</id></entry><entry><title>Canvas tiles example</title><tags>layers, stamen, canvas</tags><link href="http://openlayers.github.com/ol3/master/examples/canvas-tiles.html"/><summary>The black grid tiles are generated on the client with an HTML5 canvas. Note that the tile coordinates are ol3 normalized tile coordinates (origin bottom left), not OSM tile coordinates (origin top left).</summary><updated>2013-01-05T18:33:37+0100</updated><author><name>Tom Payne</name></author><id>http://openlayers.github.com/ol3/master/examples/canvas-tiles.html#2013-01-05T18:33:37+0100</id></entry><entry><title>Tiled WMS with custom projection example</title><tags>wms, tile, tilelayer, projection</tags><link href="http://openlayers.github.com/ol3/master/examples/wms-custom-proj.html"/><summary>Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.</summary><updated>2012-10-29T09:33:00+0100</updated><author><name>ahocevar</name></author><id>http://openlayers.github.com/ol3/master/examples/wms-custom-proj.html#2012-10-29T09:33:00+0100</id></entry><entry><title>Tiled WMS example</title><tags>wms, tile, tilelayer</tags><link href="http://openlayers.github.com/ol3/master/examples/wms.html"/><summary>Example of a tiled WMS layer.</summary><updated>2012-10-26T21:36:30+0200</updated><author><name>ahocevar</name></author><id>http://openlayers.github.com/ol3/master/examples/wms.html#2012-10-26T21:36:30+0200</id></entry></feed>
<?xml version="1.0" ?><feed xmlns="http://www.w3.org/2005/Atom"><title>OpenLayers Examples</title><id>http://openlayers.github.com/ol3/master/examples/example-list.xml#2013-03-03T07:45:07Z</id><updated>2013-03-03T07:45:07Z</updated><entry><title>WMS GetCapabilities parsing example</title><tags>wms, capabilities, getcapabilities</tags><link href="http://openlayers.github.com/ol3/master/examples/wms-capabilities.html"/><summary>Example of parsing a WMS GetCapabilities response.</summary><updated>2013-03-03T17:37:15+0100</updated><author><name>Bruno Binet</name></author><id>http://openlayers.github.com/ol3/master/examples/wms-capabilities.html#2013-03-03T17:37:15+0100</id></entry><entry><title>EPSG:4326 example</title><tags>epsg4326</tags><link href="http://openlayers.github.com/ol3/master/examples/epsg-4326.html"/><summary>Example of a epsg-4326 map.</summary><updated>2013-02-21T20:22:46+0100</updated><author><name>Tom Payne</name></author><id>http://openlayers.github.com/ol3/master/examples/epsg-4326.html#2013-02-21T20:22:46+0100</id></entry><entry><title>Full-screen example</title><tags>fullscreen, mapquest, openaerial, tile, tilelayer</tags><link href="http://openlayers.github.com/ol3/master/examples/full-screen.html"/><summary>Example of a full-screen map.</summary><updated>2013-02-04T10:52:29+0100</updated><author><name>Frederic Junod</name></author><id>http://openlayers.github.com/ol3/master/examples/full-screen.html#2013-02-04T10:52:29+0100</id></entry><entry><title>Anchored elements example</title><tags>anchored elements, overlay, popup, mapquest, openaerial</tags><link href="http://openlayers.github.com/ol3/master/examples/anchored-elements.html"/><summary>Demonstrates anchored elements.</summary><updated>2013-01-22T14:37:13+0100</updated><author><name>Tom Payne</name></author><id>http://openlayers.github.com/ol3/master/examples/anchored-elements.html#2013-01-22T14:37:13+0100</id></entry><entry><title>Two-layer example</title><tags>layers, tilejson, bing, bingmaps</tags><link href="http://openlayers.github.com/ol3/master/examples/two-layers.html"/><summary>Sync'ed DOM, WebGL and Canvas maps with two layers.</summary><updated>2013-01-21T16:13:19+0100</updated><author><name>Frederic Junod</name></author><id>http://openlayers.github.com/ol3/master/examples/two-layers.html#2013-01-21T16:13:19+0100</id></entry><entry><title>Side-by-side example</title><tags>side-by-side, webgl, dom, sync, object</tags><link href="http://openlayers.github.com/ol3/master/examples/side-by-side.html"/><summary>Side-by-side DOM, WebGL and Canvas sync'ed maps.</summary><updated>2013-01-18T14:04:33+0100</updated><author><name>Tom Payne</name></author><id>http://openlayers.github.com/ol3/master/examples/side-by-side.html#2013-01-18T14:04:33+0100</id></entry><entry><title>Canvas tiles example</title><tags>layers, stamen, canvas</tags><link href="http://openlayers.github.com/ol3/master/examples/canvas-tiles.html"/><summary>The black grid tiles are generated on the client with an HTML5 canvas. Note that the tile coordinates are ol3 normalized tile coordinates (origin bottom left), not OSM tile coordinates (origin top left).</summary><updated>2013-01-05T18:33:37+0100</updated><author><name>Tom Payne</name></author><id>http://openlayers.github.com/ol3/master/examples/canvas-tiles.html#2013-01-05T18:33:37+0100</id></entry><entry><title>Tiled WMS with custom projection example</title><tags>wms, tile, tilelayer, projection</tags><link href="http://openlayers.github.com/ol3/master/examples/wms-custom-proj.html"/><summary>Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.</summary><updated>2012-10-29T09:33:00+0100</updated><author><name>ahocevar</name></author><id>http://openlayers.github.com/ol3/master/examples/wms-custom-proj.html#2012-10-29T09:33:00+0100</id></entry><entry><title>Tiled WMS example</title><tags>wms, tile, tilelayer</tags><link href="http://openlayers.github.com/ol3/master/examples/wms.html"/><summary>Example of a tiled WMS layer.</summary><updated>2012-10-26T21:36:30+0200</updated><author><name>ahocevar</name></author><id>http://openlayers.github.com/ol3/master/examples/wms.html#2012-10-26T21:36:30+0200</id></entry></feed>

View File

@@ -1,7 +1,3 @@
goog.require('goog.debug.Console');
goog.require('goog.debug.Logger');
goog.require('goog.debug.Logger.Level');
goog.require('goog.style');
goog.require('ol.AnchoredElement');
goog.require('ol.Collection');
goog.require('ol.Coordinate');
@@ -13,12 +9,6 @@ goog.require('ol.layer.TileLayer');
goog.require('ol.source.MapQuestOpenAerial');
if (goog.DEBUG) {
goog.debug.Console.autoInstall();
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
}
var layer = new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
});
@@ -41,4 +31,9 @@ var marker = new ol.AnchoredElement({
element: element
});
marker.bindTo('position', geolocation);
goog.style.showElement(element, true);
// This is silly: gjslint generates a "No docs found for member
// 'element.style.display'" without the auto-executing function.
(function() {
element.style.display = 'block';
})();

View File

@@ -6,9 +6,9 @@
* This loader is used for the hosted examples. It is used in place of the
* development loader (examples/loader.js).
*
* ol.css and ol.js are built with Plovr/Closure, based build/ol.json.
* (`make build` should build them). They are located in the ../build/
* directory, relatively to this script.
* ol.css, ol.js, ol-simple.js, and ol-whitespace.js are built with
* Plovr/Closure. `build.py build` builds them. They are located in the
* ../build/ directory, relatively to this script.
*
* The script should be named loader.js. So it needs to be renamed to
* loader.js from loader_hosted_examples.js.
@@ -19,9 +19,27 @@
*/
(function() {
var scripts = document.getElementsByTagName('script');
var i, src, index, search, chunks, pair, params = {};
var i, pair;
var href = window.location.href, start, end, paramsString, pairs,
pageParams = {};
if (href.indexOf('?') > 0) {
start = href.indexOf('?') + 1;
end = href.indexOf('#') > 0 ? href.indexOf('#') : href.length;
paramsString = href.substring(start, end);
pairs = paramsString.split(/[&;]/);
for (i = 0; i < pairs.length; ++i) {
pair = pairs[i].split('=');
if (pair[0]) {
pageParams[decodeURIComponent(pair[0])] =
decodeURIComponent(pair[1]);
}
}
}
var scripts = document.getElementsByTagName('script');
var src, index, search, chunks, scriptParams = {};
for (i = scripts.length - 1; i >= 0; --i) {
src = scripts[i].getAttribute('src');
if (~(index = src.indexOf('loader.js?'))) {
@@ -29,18 +47,29 @@
chunks = search ? search.split('&') : [];
for (i = chunks.length - 1; i >= 0; --i) {
pair = chunks[i].split('=');
params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
if (pair[0]) {
scriptParams[decodeURIComponent(pair[0])] =
decodeURIComponent(pair[1]);
}
}
break;
}
}
var oljs = 'ol.js', mode;
if ('mode' in pageParams) {
mode = pageParams.mode.toLowerCase();
if (mode != 'advanced') {
oljs = 'ol-' + mode + '.js';
}
}
document.write('<link rel="stylesheet" href="../build/ol.css" '+
'type="text/css">');
document.write('<scr' + 'ipt type="text/javascript" ' +
'src="../build/ol.js">' +
'src="../build/' + oljs + '">' +
'</scr' + 'ipt>');
document.write('<scr' + 'ipt type="text/javascript" ' +
'src="' + encodeURIComponent(params.id) + '.js">' +
'src="' + encodeURIComponent(scriptParams.id) + '.js">' +
'</scr' + 'ipt>');
}());

View File

@@ -1,10 +1,6 @@
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.Projection');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.animation');
@@ -12,18 +8,13 @@ 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');
if (goog.DEBUG) {
goog.debug.Console.autoInstall();
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
}
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 +35,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: '&nbsp;'
});
@@ -61,7 +52,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: '&nbsp;'
});
@@ -78,7 +69,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: '&nbsp;'
});
@@ -131,7 +122,7 @@ keyboardInteraction.addCallback('l', function() {
view.setCenter(LONDON);
});
keyboardInteraction.addCallback('L', function() {
var start = goog.now();
var start = +new Date();
var duration = 5000;
var bounce = ol.animation.bounce({
resolution: 2 * view.getResolution(),
@@ -166,7 +157,7 @@ keyboardInteraction.addCallback('m', function() {
view.setCenter(MOSCOW);
});
keyboardInteraction.addCallback('M', function() {
var start = goog.now();
var start = +new Date();
var duration = 5000;
var bounce = ol.animation.bounce({
resolution: 2 * view.getResolution(),

View File

@@ -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
})
@@ -50,6 +50,8 @@ var canvasMap = new ol.Map({
canvasMap.bindTo('layers', webglMap);
canvasMap.bindTo('view', webglMap);
goog.events.listen(goog.dom.getElement('canvas-export'), 'click', function(e) {
// Handle clicks on the "canvas-export" element.
var element = document.getElementById('canvas-export');
element.addEventListener('click', function(e) {
e.target.href = canvasMap.getRenderer().getCanvas().toDataURL('image/jpeg');
});
}, false);

View File

@@ -13,9 +13,9 @@
height: 100%;
}
#log {
height: 500px;
position: absolute;
top: 130px;
font-size: 12px;
}
#text {
position: absolute;
@@ -35,7 +35,7 @@
<title>wms capabilities example</title>
</head>
<body>
<div id="log"></div>
<pre id="log"></pre>
<div id="map">
<div id="text">
<h1 id="title">WMS GetCapabilities parsing example</h1>

View File

@@ -1,26 +1,20 @@
goog.require('goog.debug.Console');
goog.require('goog.debug.DivConsole');
goog.require('goog.debug.Logger');
goog.require('goog.debug.Logger.Level');
goog.require('goog.json.Serializer');
goog.require('goog.net.XhrIo');
goog.require('ol.parser.ogc.WMSCapabilities');
if (goog.DEBUG) {
goog.debug.Console.autoInstall();
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
var logconsole = new goog.debug.DivConsole(goog.dom.getElement('log'));
logconsole.setCapturing(true);
}
var parser = new ol.parser.ogc.WMSCapabilities(), result;
var url = '../test/spec/ol/parser/ogc/xml/wmscapabilities_v1_3_0/ogcsample.xml';
goog.net.XhrIo.send(url, function(e) {
var xhr = e.target;
result = parser.read(xhr.getResponseXml());
if (goog.DEBUG) {
var output = new goog.json.Serializer().serialize(result);
goog.debug.Logger.getLogger('ol').info(output);
var url = 'data/ogcsample.xml';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
/**
* onload handler for the XHR request.
*/
xhr.onload = function() {
if (xhr.status == 200) {
result = parser.read(xhr.responseXML);
document.getElementById('log').innerHTML =
window.JSON.stringify(result, undefined, 2);
}
});
};
xhr.send();

View File

@@ -1,6 +1,3 @@
goog.require('goog.debug.Console');
goog.require('goog.debug.Logger');
goog.require('goog.debug.Logger.Level');
goog.require('ol.Attribution');
goog.require('ol.Collection');
goog.require('ol.Coordinate');
@@ -12,26 +9,21 @@ 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');
if (goog.DEBUG) {
goog.debug.Console.autoInstall();
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
}
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.
var projectionExtent = epsg21781.getExtent();
var maxResolution = Math.max(
projectionExtent.maxX - projectionExtent.minX,
projectionExtent.maxY - projectionExtent.minY) / 256;
var maxResolution = Math.max(projectionExtent.getWidth(),
projectionExtent.getHeight()) / 256;
var resolutions = new Array(10);
for (var i = 0; i < 10; ++i) {
resolutions[i] = maxResolution / Math.pow(2.0, i);

View File

@@ -1,6 +1,3 @@
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.Extent');
@@ -12,12 +9,6 @@ goog.require('ol.source.MapQuestOpenAerial');
goog.require('ol.source.TiledWMS');
if (goog.DEBUG) {
goog.debug.Console.autoInstall();
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
}
var layers = new ol.Collection([
new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
@@ -32,7 +23,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({