@@ -0,0 +1,56 @@
|
|||||||
|
<!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="../css/ol.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<title>XYZ Esri example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></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="span12">
|
||||||
|
<h4 id="title">XYZ Esri example</h4>
|
||||||
|
<p id="shortdesc">Example of a XYZ source using Esri tiles.</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p>See the <a href="xyz-esri.js" target="_blank">xyz-esri.js source</a> for details on how this is done.</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">xyz, esri</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="loader.js?id=xyz-esri" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHint');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.layer.Tile');
|
||||||
|
goog.require('ol.proj');
|
||||||
|
goog.require('ol.source.XYZ');
|
||||||
|
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
target: 'map',
|
||||||
|
layers: [
|
||||||
|
new ol.layer.Tile({
|
||||||
|
source: new ol.source.XYZ({
|
||||||
|
url: 'http://server.arcgisonline.com/ArcGIS/rest/services/' +
|
||||||
|
'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
],
|
||||||
|
renderer: ol.RendererHint.CANVAS,
|
||||||
|
view: new ol.View2D({
|
||||||
|
center: ol.proj.transform([-121.1, 47.5], 'EPSG:4326', 'EPSG:3857'),
|
||||||
|
zoom: 7
|
||||||
|
})
|
||||||
|
});
|
||||||
@@ -605,6 +605,25 @@
|
|||||||
* @property {Array.<string>|undefined} urls Urls.
|
* @property {Array.<string>|undefined} urls Urls.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.source.XYZOptions
|
||||||
|
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
|
||||||
|
* @property {null|string|undefined} crossOrigin Cross origin setting for image
|
||||||
|
* requests.
|
||||||
|
* @property {ol.Extent|undefined} extent Extent.
|
||||||
|
* @property {string|undefined} logo Logo.
|
||||||
|
* @property {ol.ProjectionLike} projection Projection.
|
||||||
|
* @property {number|undefined} maxZoom Optional max zoom level. The default is
|
||||||
|
* 18.
|
||||||
|
* @property {number|undefined} minZoom Unsupported (TODO: remove this).
|
||||||
|
* @property {ol.TileUrlFunctionType|undefined} tileUrlFunction Optional
|
||||||
|
* function to get tile URL given a tile coordinate and the projection.
|
||||||
|
* Required if url or urls are not provided.
|
||||||
|
* @property {string|undefined} url URL template. Must include '{x}', '{y}',
|
||||||
|
* and '{z}' placeholders.
|
||||||
|
* @property {Array.<string>|undefined} urls An array of URL templates.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.style.IconOptions
|
* @typedef {Object} ol.style.IconOptions
|
||||||
* @property {string|ol.expr.Expression} url Icon image url.
|
* @property {string|ol.expr.Expression} url Icon image url.
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ ol.source.OSM = function(opt_options) {
|
|||||||
attributions = ol.source.OSM.ATTRIBUTIONS;
|
attributions = ol.source.OSM.ATTRIBUTIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
var maxZoom = goog.isDef(options.maxZoom) ? options.maxZoom : 18;
|
|
||||||
|
|
||||||
var url = goog.isDef(options.url) ?
|
var url = goog.isDef(options.url) ?
|
||||||
options.url : 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
options.url : 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||||
|
|
||||||
@@ -32,7 +30,7 @@ ol.source.OSM = function(opt_options) {
|
|||||||
attributions: attributions,
|
attributions: attributions,
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
opaque: true,
|
opaque: true,
|
||||||
maxZoom: maxZoom,
|
maxZoom: options.maxZoom,
|
||||||
url: url
|
url: url
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
@exportClass ol.source.XYZ ol.source.XYZOptions
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
goog.provide('ol.source.XYZ');
|
goog.provide('ol.source.XYZ');
|
||||||
goog.provide('ol.source.XYZOptions');
|
|
||||||
|
|
||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
goog.require('ol.Projection');
|
|
||||||
goog.require('ol.TileUrlFunction');
|
goog.require('ol.TileUrlFunction');
|
||||||
goog.require('ol.TileUrlFunctionType');
|
goog.require('ol.TileUrlFunctionType');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
@@ -10,21 +8,6 @@ goog.require('ol.source.TileImage');
|
|||||||
goog.require('ol.tilegrid.XYZ');
|
goog.require('ol.tilegrid.XYZ');
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
|
||||||
* crossOrigin: (string|undefined),
|
|
||||||
* extent: (ol.Extent|undefined),
|
|
||||||
* logo: (string|undefined),
|
|
||||||
* maxZoom: number,
|
|
||||||
* minZoom: (number|undefined),
|
|
||||||
* projection: (ol.Projection|undefined),
|
|
||||||
* tileUrlFunction: (ol.TileUrlFunctionType|undefined),
|
|
||||||
* url: (string|undefined),
|
|
||||||
* urls: (Array.<string>|undefined)}}
|
|
||||||
*/
|
|
||||||
ol.source.XYZOptions;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -49,9 +32,10 @@ ol.source.XYZ = function(options) {
|
|||||||
ol.TileUrlFunction.expandUrl(options.url));
|
ol.TileUrlFunction.expandUrl(options.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var maxZoom = goog.isDef(options.maxZoom) ? options.maxZoom : 18;
|
||||||
|
|
||||||
var tileGrid = new ol.tilegrid.XYZ({
|
var tileGrid = new ol.tilegrid.XYZ({
|
||||||
maxZoom: options.maxZoom,
|
maxZoom: maxZoom
|
||||||
minZoom: options.minZoom
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var tileCoordTransform = tileGrid.createTileCoordTransform({
|
var tileCoordTransform = tileGrid.createTileCoordTransform({
|
||||||
|
|||||||
Reference in New Issue
Block a user