Merge branch 'master' of github.com:openlayers/ol3 into vector
Resolved conflicts: src/ol/renderer/canvas/canvasrenderer.js
This commit is contained in:
@@ -5,9 +5,10 @@ goog.require('goog.dom.TagName');
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Is supported.
|
||||
* @const
|
||||
* @type {boolean} Is supported.
|
||||
*/
|
||||
ol.canvas.isSupported = function() {
|
||||
ol.canvas.SUPPORTED = (function() {
|
||||
if (!('HTMLCanvasElement' in goog.global)) {
|
||||
return false;
|
||||
}
|
||||
@@ -18,4 +19,4 @@ ol.canvas.isSupported = function() {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// FIXME handle date line wrap
|
||||
// FIXME does not handle image sources
|
||||
|
||||
goog.provide('ol.control.Attribution');
|
||||
|
||||
@@ -10,11 +9,12 @@ goog.require('goog.events');
|
||||
goog.require('goog.object');
|
||||
goog.require('goog.style');
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.FrameState');
|
||||
goog.require('ol.MapEvent');
|
||||
goog.require('ol.MapEventType');
|
||||
goog.require('ol.TileRange');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.source.TileSource');
|
||||
goog.require('ol.source.Source');
|
||||
|
||||
|
||||
|
||||
@@ -66,16 +66,46 @@ ol.control.Attribution = function(attributionOptions) {
|
||||
goog.inherits(ol.control.Attribution, ol.control.Control);
|
||||
|
||||
|
||||
/**
|
||||
* @param {?Object.<string, Object.<string, ol.TileRange>>} usedTiles Used
|
||||
* tiles.
|
||||
* @param {Object.<string, ol.source.Source>} sources Sources.
|
||||
* @return {Object.<string, ol.Attribution>} Attributions.
|
||||
*/
|
||||
ol.control.Attribution.prototype.getTileSourceAttributions =
|
||||
function(usedTiles, sources) {
|
||||
/** @type {Object.<string, ol.Attribution>} */
|
||||
var attributions = {};
|
||||
var i, tileRanges, tileSource, tileSourceAttribution,
|
||||
tileSourceAttributionKey, tileSourceAttributions, tileSourceKey, z;
|
||||
for (tileSourceKey in usedTiles) {
|
||||
goog.asserts.assert(tileSourceKey in sources);
|
||||
tileSource = sources[tileSourceKey];
|
||||
tileSourceAttributions = tileSource.getAttributions();
|
||||
if (goog.isNull(tileSourceAttributions)) {
|
||||
continue;
|
||||
}
|
||||
tileRanges = usedTiles[tileSourceKey];
|
||||
for (i = 0; i < tileSourceAttributions.length; ++i) {
|
||||
tileSourceAttribution = tileSourceAttributions[i];
|
||||
tileSourceAttributionKey = goog.getUid(tileSourceAttribution).toString();
|
||||
if (tileSourceAttributionKey in attributions) {
|
||||
continue;
|
||||
}
|
||||
if (tileSourceAttribution.intersectsAnyTileRange(tileRanges)) {
|
||||
attributions[tileSourceAttributionKey] = tileSourceAttribution;
|
||||
}
|
||||
}
|
||||
}
|
||||
return attributions;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.MapEvent} mapEvent Map event.
|
||||
*/
|
||||
ol.control.Attribution.prototype.handleMapPostrender = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (goog.isNull(frameState)) {
|
||||
this.updateElement_(null);
|
||||
} else {
|
||||
this.updateElement_(frameState.usedTiles);
|
||||
}
|
||||
this.updateElement_(mapEvent.frameState);
|
||||
};
|
||||
|
||||
|
||||
@@ -99,12 +129,11 @@ ol.control.Attribution.prototype.setMap = function(map) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {?Object.<string, Object.<string, ol.TileRange>>} usedTiles Used
|
||||
* tiles.
|
||||
* @param {?ol.FrameState} frameState Frame state.
|
||||
*/
|
||||
ol.control.Attribution.prototype.updateElement_ = function(usedTiles) {
|
||||
ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
||||
|
||||
if (goog.isNull(usedTiles)) {
|
||||
if (goog.isNull(frameState)) {
|
||||
if (this.renderedVisible_) {
|
||||
goog.style.showElement(this.element, false);
|
||||
this.renderedVisible_ = false;
|
||||
@@ -116,15 +145,13 @@ ol.control.Attribution.prototype.updateElement_ = function(usedTiles) {
|
||||
|
||||
/** @type {Object.<string, boolean>} */
|
||||
var attributionsToRemove = {};
|
||||
/** @type {Object.<string, ol.source.TileSource>} */
|
||||
var tileSources = {};
|
||||
/** @type {Object.<string, ol.source.Source>} */
|
||||
var sources = {};
|
||||
var layers = map.getLayers();
|
||||
if (goog.isDef(layers)) {
|
||||
layers.forEach(function(layer) {
|
||||
var source = layer.getSource();
|
||||
if (source instanceof ol.source.TileSource) {
|
||||
tileSources[goog.getUid(source).toString()] = source;
|
||||
}
|
||||
sources[goog.getUid(source).toString()] = source;
|
||||
var attributions = source.getAttributions();
|
||||
if (!goog.isNull(attributions)) {
|
||||
var attribution, i;
|
||||
@@ -138,34 +165,16 @@ ol.control.Attribution.prototype.updateElement_ = function(usedTiles) {
|
||||
}
|
||||
|
||||
/** @type {Object.<string, ol.Attribution>} */
|
||||
var attributions = {};
|
||||
var i, tileRanges, tileSource, tileSourceAttribution,
|
||||
tileSourceAttributionKey, tileSourceAttributions, tileSourceKey, z;
|
||||
for (tileSourceKey in usedTiles) {
|
||||
goog.asserts.assert(tileSourceKey in tileSources);
|
||||
tileSource = tileSources[tileSourceKey];
|
||||
tileSourceAttributions = tileSource.getAttributions();
|
||||
if (goog.isNull(tileSourceAttributions)) {
|
||||
continue;
|
||||
}
|
||||
tileRanges = usedTiles[tileSourceKey];
|
||||
for (i = 0; i < tileSourceAttributions.length; ++i) {
|
||||
tileSourceAttribution = tileSourceAttributions[i];
|
||||
tileSourceAttributionKey = goog.getUid(tileSourceAttribution).toString();
|
||||
if (tileSourceAttributionKey in attributions) {
|
||||
continue;
|
||||
}
|
||||
if (tileSourceAttribution.intersectsAnyTileRange(tileRanges)) {
|
||||
attributions[tileSourceAttributionKey] = tileSourceAttribution;
|
||||
}
|
||||
}
|
||||
}
|
||||
var attributions = goog.object.clone(frameState.attributions);
|
||||
var tileSourceAttributions = this.getTileSourceAttributions(
|
||||
frameState.usedTiles, sources);
|
||||
goog.object.extend(attributions, tileSourceAttributions);
|
||||
|
||||
/** @type {Array.<number>} */
|
||||
var attributionKeys =
|
||||
goog.array.map(goog.object.getKeys(attributions), Number);
|
||||
goog.array.sort(attributionKeys);
|
||||
var attributionElement, attributionKey;
|
||||
var i, attributionElement, attributionKey;
|
||||
for (i = 0; i < attributionKeys.length; ++i) {
|
||||
attributionKey = attributionKeys[i].toString();
|
||||
if (attributionKey in this.attributionElements_) {
|
||||
|
||||
@@ -88,3 +88,19 @@ ol.Coordinate.toStringXY = function(coordinate, opt_precision) {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Create an ol.Coordinate from an Array and take into account axis order.
|
||||
* @param {Array} array The array with coordinates.
|
||||
* @param {string} axis the axis info.
|
||||
* @return {ol.Coordinate} The coordinate created.
|
||||
*/
|
||||
ol.Coordinate.fromProjectedArray = function(array, axis) {
|
||||
var firstAxis = axis.charAt(0);
|
||||
if (firstAxis === 'n' || firstAxis === 's') {
|
||||
return new ol.Coordinate(array[1], array[0]);
|
||||
} else {
|
||||
return new ol.Coordinate(array[0], array[1]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ goog.provide('ol.PostRenderFunction');
|
||||
goog.provide('ol.PreRenderFunction');
|
||||
|
||||
goog.require('goog.vec.Mat4');
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.Color');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.Size');
|
||||
@@ -18,6 +19,7 @@ goog.require('ol.layer.LayerState');
|
||||
|
||||
/**
|
||||
* @typedef {{animate: boolean,
|
||||
* attributions: Object.<string, ol.Attribution>,
|
||||
* backgroundColor: ol.Color,
|
||||
* coordinateToPixelMatrix: goog.vec.Mat4.Number,
|
||||
* extent: (null|ol.Extent),
|
||||
|
||||
@@ -42,7 +42,7 @@ ol.Geolocation = function(opt_positionOptions) {
|
||||
*/
|
||||
this.position_ = null;
|
||||
|
||||
if (ol.Geolocation.isSupported) {
|
||||
if (ol.Geolocation.SUPPORTED) {
|
||||
goog.events.listen(
|
||||
this, ol.Object.getChangedEventType(ol.GeolocationProperty.PROJECTION),
|
||||
this.handleProjectionChanged_, false, this);
|
||||
@@ -86,9 +86,10 @@ ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {boolean} Is supported.
|
||||
*/
|
||||
ol.Geolocation.isSupported = 'geolocation' in navigator;
|
||||
ol.Geolocation.SUPPORTED = 'geolocation' in navigator;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ goog.require('goog.array');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventTarget');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.Extent');
|
||||
|
||||
|
||||
@@ -27,8 +28,15 @@ ol.ImageState = {
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {string} src Image source URI.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {Array.<ol.Attribution>} attributions Attributions.
|
||||
*/
|
||||
ol.Image = function(extent, resolution, src, crossOrigin) {
|
||||
ol.Image = function(extent, resolution, src, crossOrigin, attributions) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<ol.Attribution>}
|
||||
*/
|
||||
this.attributions_ = attributions;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -86,6 +94,14 @@ ol.Image.prototype.dispatchChangeEvent = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {Array.<ol.Attribution>} Attributions.
|
||||
*/
|
||||
ol.Image.prototype.getAttributions = function() {
|
||||
return this.attributions_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
|
||||
@@ -58,11 +58,11 @@ goog.require('ol.interaction.condition');
|
||||
goog.require('ol.layer.Layer');
|
||||
goog.require('ol.renderer.Map');
|
||||
goog.require('ol.renderer.canvas.Map');
|
||||
goog.require('ol.renderer.canvas.isSupported');
|
||||
goog.require('ol.renderer.canvas.SUPPORTED');
|
||||
goog.require('ol.renderer.dom.Map');
|
||||
goog.require('ol.renderer.dom.isSupported');
|
||||
goog.require('ol.renderer.dom.SUPPORTED');
|
||||
goog.require('ol.renderer.webgl.Map');
|
||||
goog.require('ol.renderer.webgl.isSupported');
|
||||
goog.require('ol.renderer.webgl.SUPPORTED');
|
||||
|
||||
|
||||
/**
|
||||
@@ -664,6 +664,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
var view2DState = view2D.getView2DState();
|
||||
frameState = {
|
||||
animate: false,
|
||||
attributions: {},
|
||||
backgroundColor: goog.isDef(backgroundColor) ?
|
||||
backgroundColor : new ol.Color(255, 255, 255, 1),
|
||||
coordinateToPixelMatrix: this.coordinateToPixelMatrix_,
|
||||
@@ -857,17 +858,17 @@ ol.Map.createOptionsInternal = function(mapOptions) {
|
||||
for (i = 0; i < rendererHints.length; ++i) {
|
||||
rendererHint = rendererHints[i];
|
||||
if (rendererHint == ol.RendererHint.CANVAS) {
|
||||
if (ol.ENABLE_CANVAS && ol.renderer.canvas.isSupported()) {
|
||||
if (ol.ENABLE_CANVAS && ol.renderer.canvas.SUPPORTED) {
|
||||
rendererConstructor = ol.renderer.canvas.Map;
|
||||
break;
|
||||
}
|
||||
} else if (rendererHint == ol.RendererHint.DOM) {
|
||||
if (ol.ENABLE_DOM && ol.renderer.dom.isSupported()) {
|
||||
if (ol.ENABLE_DOM && ol.renderer.dom.SUPPORTED) {
|
||||
rendererConstructor = ol.renderer.dom.Map;
|
||||
break;
|
||||
}
|
||||
} else if (rendererHint == ol.RendererHint.WEBGL) {
|
||||
if (ol.ENABLE_WEBGL && ol.renderer.webgl.isSupported()) {
|
||||
if (ol.ENABLE_WEBGL && ol.renderer.webgl.SUPPORTED) {
|
||||
rendererConstructor = ol.renderer.webgl.Map;
|
||||
break;
|
||||
}
|
||||
|
||||
214
src/ol/parser/ogc/owscommon_v1.js
Normal file
214
src/ol/parser/ogc/owscommon_v1.js
Normal file
@@ -0,0 +1,214 @@
|
||||
goog.provide('ol.parser.ogc.OWSCommon_v1');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.parser.XML');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.parser.XML}
|
||||
*/
|
||||
ol.parser.ogc.OWSCommon_v1 = function() {
|
||||
this.readers = {
|
||||
'http://www.opengis.net/ows': {
|
||||
'ServiceIdentification': function(node, obj) {
|
||||
obj['serviceIdentification'] = {};
|
||||
this.readChildNodes(node, obj['serviceIdentification']);
|
||||
},
|
||||
'Title': function(node, obj) {
|
||||
obj['title'] = this.getChildValue(node);
|
||||
},
|
||||
'Abstract': function(node, serviceIdentification) {
|
||||
serviceIdentification['abstract'] = this.getChildValue(node);
|
||||
},
|
||||
'Keywords': function(node, serviceIdentification) {
|
||||
serviceIdentification['keywords'] = {};
|
||||
this.readChildNodes(node, serviceIdentification['keywords']);
|
||||
},
|
||||
'Keyword': function(node, keywords) {
|
||||
keywords[this.getChildValue(node)] = true;
|
||||
},
|
||||
'ServiceType': function(node, serviceIdentification) {
|
||||
serviceIdentification['serviceType'] = {
|
||||
'codeSpace': node.getAttribute('codeSpace'),
|
||||
'value': this.getChildValue(node)};
|
||||
},
|
||||
'ServiceTypeVersion': function(node, serviceIdentification) {
|
||||
serviceIdentification['serviceTypeVersion'] = this.getChildValue(node);
|
||||
},
|
||||
'Fees': function(node, serviceIdentification) {
|
||||
serviceIdentification['fees'] = this.getChildValue(node);
|
||||
},
|
||||
'AccessConstraints': function(node, serviceIdentification) {
|
||||
serviceIdentification['accessConstraints'] =
|
||||
this.getChildValue(node);
|
||||
},
|
||||
'ServiceProvider': function(node, obj) {
|
||||
obj['serviceProvider'] = {};
|
||||
this.readChildNodes(node, obj['serviceProvider']);
|
||||
},
|
||||
'ProviderName': function(node, serviceProvider) {
|
||||
serviceProvider['providerName'] = this.getChildValue(node);
|
||||
},
|
||||
'ProviderSite': function(node, serviceProvider) {
|
||||
serviceProvider['providerSite'] = this.getAttributeNS(node,
|
||||
'http://www.w3.org/1999/xlink', 'href');
|
||||
},
|
||||
'ServiceContact': function(node, serviceProvider) {
|
||||
serviceProvider['serviceContact'] = {};
|
||||
this.readChildNodes(node, serviceProvider['serviceContact']);
|
||||
},
|
||||
'IndividualName': function(node, serviceContact) {
|
||||
serviceContact['individualName'] = this.getChildValue(node);
|
||||
},
|
||||
'PositionName': function(node, serviceContact) {
|
||||
serviceContact['positionName'] = this.getChildValue(node);
|
||||
},
|
||||
'ContactInfo': function(node, serviceContact) {
|
||||
serviceContact['contactInfo'] = {};
|
||||
this.readChildNodes(node, serviceContact['contactInfo']);
|
||||
},
|
||||
'Phone': function(node, contactInfo) {
|
||||
contactInfo['phone'] = {};
|
||||
this.readChildNodes(node, contactInfo['phone']);
|
||||
},
|
||||
'Voice': function(node, phone) {
|
||||
phone['voice'] = this.getChildValue(node);
|
||||
},
|
||||
'Address': function(node, contactInfo) {
|
||||
contactInfo['address'] = {};
|
||||
this.readChildNodes(node, contactInfo['address']);
|
||||
},
|
||||
'DeliveryPoint': function(node, address) {
|
||||
address['deliveryPoint'] = this.getChildValue(node);
|
||||
},
|
||||
'City': function(node, address) {
|
||||
address['city'] = this.getChildValue(node);
|
||||
},
|
||||
'AdministrativeArea': function(node, address) {
|
||||
address['administrativeArea'] = this.getChildValue(node);
|
||||
},
|
||||
'PostalCode': function(node, address) {
|
||||
address['postalCode'] = this.getChildValue(node);
|
||||
},
|
||||
'Country': function(node, address) {
|
||||
address['country'] = this.getChildValue(node);
|
||||
},
|
||||
'ElectronicMailAddress': function(node, address) {
|
||||
address['electronicMailAddress'] = this.getChildValue(node);
|
||||
},
|
||||
'Role': function(node, serviceContact) {
|
||||
serviceContact['role'] = this.getChildValue(node);
|
||||
},
|
||||
'OperationsMetadata': function(node, obj) {
|
||||
obj['operationsMetadata'] = {};
|
||||
this.readChildNodes(node, obj['operationsMetadata']);
|
||||
},
|
||||
'Operation': function(node, operationsMetadata) {
|
||||
var name = node.getAttribute('name');
|
||||
operationsMetadata[name] = {};
|
||||
this.readChildNodes(node, operationsMetadata[name]);
|
||||
},
|
||||
'DCP': function(node, operation) {
|
||||
operation['dcp'] = {};
|
||||
this.readChildNodes(node, operation['dcp']);
|
||||
},
|
||||
'HTTP': function(node, dcp) {
|
||||
dcp['http'] = {};
|
||||
this.readChildNodes(node, dcp['http']);
|
||||
},
|
||||
'Get': function(node, http) {
|
||||
if (!http['get']) {
|
||||
http['get'] = [];
|
||||
}
|
||||
var obj = {
|
||||
'url': this.getAttributeNS(node, 'http://www.w3.org/1999/xlink',
|
||||
'href')
|
||||
};
|
||||
this.readChildNodes(node, obj);
|
||||
http['get'].push(obj);
|
||||
},
|
||||
'Post': function(node, http) {
|
||||
if (!http['post']) {
|
||||
http['post'] = [];
|
||||
}
|
||||
var obj = {
|
||||
'url': this.getAttributeNS(node, 'http://www.w3.org/1999/xlink',
|
||||
'href')
|
||||
};
|
||||
this.readChildNodes(node, obj);
|
||||
http['post'].push(obj);
|
||||
},
|
||||
'Parameter': function(node, operation) {
|
||||
if (!operation['parameters']) {
|
||||
operation['parameters'] = {};
|
||||
}
|
||||
var name = node.getAttribute('name');
|
||||
operation['parameters'][name] = {};
|
||||
this.readChildNodes(node, operation['parameters'][name]);
|
||||
},
|
||||
'Constraint': function(node, obj) {
|
||||
if (!obj['constraints']) {
|
||||
obj['constraints'] = {};
|
||||
}
|
||||
var name = node.getAttribute('name');
|
||||
obj['constraints'][name] = {};
|
||||
this.readChildNodes(node, obj['constraints'][name]);
|
||||
},
|
||||
'Value': function(node, allowedValues) {
|
||||
allowedValues[this.getChildValue(node)] = true;
|
||||
},
|
||||
'OutputFormat': function(node, obj) {
|
||||
obj['formats'].push({'value': this.getChildValue(node)});
|
||||
this.readChildNodes(node, obj);
|
||||
},
|
||||
'WGS84BoundingBox': function(node, obj) {
|
||||
var boundingBox = {};
|
||||
boundingBox['crs'] = node.getAttribute('crs');
|
||||
if (obj['BoundingBox']) {
|
||||
obj['BoundingBox'].push(boundingBox);
|
||||
} else {
|
||||
obj['projection'] = boundingBox['crs'];
|
||||
boundingBox = obj;
|
||||
}
|
||||
this.readChildNodes(node, boundingBox);
|
||||
},
|
||||
'BoundingBox': function(node, obj) {
|
||||
// FIXME: We consider that BoundingBox is the same as WGS84BoundingBox
|
||||
// LowerCorner = "min_x min_y"
|
||||
// UpperCorner = "max_x max_y"
|
||||
// It should normally depend on the projection
|
||||
var readers = this.readers['http://www.opengis.net/ows'];
|
||||
readers['WGS84BoundingBox'].apply(this, [node, obj]);
|
||||
},
|
||||
'LowerCorner': function(node, obj) {
|
||||
var str = this.getChildValue(node).replace(
|
||||
this.regExes.trimSpace, '');
|
||||
str = str.replace(this.regExes.trimComma, ',');
|
||||
var pointList = str.split(this.regExes.splitSpace);
|
||||
obj['left'] = pointList[0];
|
||||
obj['bottom'] = pointList[1];
|
||||
},
|
||||
'UpperCorner': function(node, obj) {
|
||||
var str = this.getChildValue(node).replace(
|
||||
this.regExes.trimSpace, '');
|
||||
str = str.replace(this.regExes.trimComma, ',');
|
||||
var pointList = str.split(this.regExes.splitSpace);
|
||||
obj['right'] = pointList[0];
|
||||
obj['top'] = pointList[1];
|
||||
obj['bounds'] = new ol.Extent(parseFloat(obj['left']),
|
||||
parseFloat(obj['bottom']), parseFloat(obj['right']),
|
||||
parseFloat(obj['top']));
|
||||
delete obj['left'];
|
||||
delete obj['bottom'];
|
||||
delete obj['right'];
|
||||
delete obj['top'];
|
||||
},
|
||||
'Language': function(node, obj) {
|
||||
obj['language'] = this.getChildValue(node);
|
||||
}
|
||||
}
|
||||
};
|
||||
goog.base(this);
|
||||
};
|
||||
goog.inherits(ol.parser.ogc.OWSCommon_v1, ol.parser.XML);
|
||||
45
src/ol/parser/ogc/owscommon_v1_1_0.js
Normal file
45
src/ol/parser/ogc/owscommon_v1_1_0.js
Normal file
@@ -0,0 +1,45 @@
|
||||
goog.provide('ol.parser.ogc.OWSCommon_v1_1_0');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.parser.ogc.OWSCommon_v1');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.parser.ogc.OWSCommon_v1}
|
||||
*/
|
||||
ol.parser.ogc.OWSCommon_v1_1_0 = function() {
|
||||
goog.base(this);
|
||||
this.readers['http://www.opengis.net/ows/1.1'] =
|
||||
this.readers['http://www.opengis.net/ows'];
|
||||
goog.object.extend(this.readers['http://www.opengis.net/ows/1.1'], {
|
||||
'AllowedValues': function(node, parameter) {
|
||||
parameter['allowedValues'] = {};
|
||||
this.readChildNodes(node, parameter['allowedValues']);
|
||||
},
|
||||
'AnyValue': function(node, parameter) {
|
||||
parameter['anyValue'] = true;
|
||||
},
|
||||
'DataType': function(node, parameter) {
|
||||
parameter['dataType'] = this.getChildValue(node);
|
||||
},
|
||||
'Range': function(node, allowedValues) {
|
||||
allowedValues['range'] = {};
|
||||
this.readChildNodes(node, allowedValues['range']);
|
||||
},
|
||||
'MinimumValue': function(node, range) {
|
||||
range['minValue'] = this.getChildValue(node);
|
||||
},
|
||||
'MaximumValue': function(node, range) {
|
||||
range['maxValue'] = this.getChildValue(node);
|
||||
},
|
||||
'Identifier': function(node, obj) {
|
||||
obj['identifier'] = this.getChildValue(node);
|
||||
},
|
||||
'SupportedCRS': function(node, obj) {
|
||||
obj['supportedCRS'] = this.getChildValue(node);
|
||||
}
|
||||
});
|
||||
};
|
||||
goog.inherits(ol.parser.ogc.OWSCommon_v1_1_0,
|
||||
ol.parser.ogc.OWSCommon_v1);
|
||||
2
src/ol/parser/ogc/wmtscapabilities.exports
Normal file
2
src/ol/parser/ogc/wmtscapabilities.exports
Normal file
@@ -0,0 +1,2 @@
|
||||
@exportSymbol ol.parser.ogc.WMTSCapabilities
|
||||
@exportProperty ol.parser.ogc.WMTSCapabilities.prototype.read
|
||||
19
src/ol/parser/ogc/wmtscapabilities.js
Normal file
19
src/ol/parser/ogc/wmtscapabilities.js
Normal file
@@ -0,0 +1,19 @@
|
||||
goog.provide('ol.parser.ogc.WMTSCapabilities');
|
||||
goog.require('ol.parser.ogc.Versioned');
|
||||
goog.require('ol.parser.ogc.WMTSCapabilities_v1_0_0');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object=} opt_options Options which will be set on this object.
|
||||
* @extends {ol.parser.ogc.Versioned}
|
||||
*/
|
||||
ol.parser.ogc.WMTSCapabilities = function(opt_options) {
|
||||
opt_options = opt_options || {};
|
||||
opt_options['defaultVersion'] = '1.0.0';
|
||||
this.parsers = {};
|
||||
this.parsers['v1_0_0'] = ol.parser.ogc.WMTSCapabilities_v1_0_0;
|
||||
goog.base(this, opt_options);
|
||||
};
|
||||
goog.inherits(ol.parser.ogc.WMTSCapabilities, ol.parser.ogc.Versioned);
|
||||
161
src/ol/parser/ogc/wmtscapabilities_v1_0_0.js
Normal file
161
src/ol/parser/ogc/wmtscapabilities_v1_0_0.js
Normal file
@@ -0,0 +1,161 @@
|
||||
goog.provide('ol.parser.ogc.WMTSCapabilities_v1_0_0');
|
||||
goog.require('goog.dom.xml');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Projection');
|
||||
goog.require('ol.parser.XML');
|
||||
goog.require('ol.parser.ogc.OWSCommon_v1_1_0');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.parser.XML}
|
||||
*/
|
||||
ol.parser.ogc.WMTSCapabilities_v1_0_0 = function() {
|
||||
this.readers = {
|
||||
'http://www.opengis.net/wmts/1.0': {
|
||||
'Capabilities': function(node, obj) {
|
||||
this.readChildNodes(node, obj);
|
||||
},
|
||||
'Contents': function(node, obj) {
|
||||
obj['contents'] = {};
|
||||
obj['contents']['layers'] = [];
|
||||
obj['contents']['tileMatrixSets'] = {};
|
||||
this.readChildNodes(node, obj['contents']);
|
||||
},
|
||||
'Layer': function(node, obj) {
|
||||
var layer = {
|
||||
'styles': [],
|
||||
'formats': [],
|
||||
'dimensions': [],
|
||||
'tileMatrixSetLinks': []
|
||||
};
|
||||
layer['layers'] = [];
|
||||
this.readChildNodes(node, layer);
|
||||
obj['layers'].push(layer);
|
||||
},
|
||||
'Style': function(node, obj) {
|
||||
var style = {};
|
||||
style['isDefault'] = (node.getAttribute('isDefault') === 'true');
|
||||
this.readChildNodes(node, style);
|
||||
obj['styles'].push(style);
|
||||
},
|
||||
'Format': function(node, obj) {
|
||||
obj['formats'].push(this.getChildValue(node));
|
||||
},
|
||||
'TileMatrixSetLink': function(node, obj) {
|
||||
var tileMatrixSetLink = {};
|
||||
this.readChildNodes(node, tileMatrixSetLink);
|
||||
obj['tileMatrixSetLinks'].push(tileMatrixSetLink);
|
||||
},
|
||||
'TileMatrixSet': function(node, obj) {
|
||||
// node could be child of wmts:Contents or wmts:TileMatrixSetLink
|
||||
// duck type wmts:Contents by looking for layers
|
||||
if (obj['layers']) {
|
||||
// TileMatrixSet as object type in schema
|
||||
var tileMatrixSet = {
|
||||
'matrixIds': []
|
||||
};
|
||||
this.readChildNodes(node, tileMatrixSet);
|
||||
obj['tileMatrixSets'][tileMatrixSet['identifier']] = tileMatrixSet;
|
||||
} else {
|
||||
// TileMatrixSet as string type in schema
|
||||
obj['tileMatrixSet'] = this.getChildValue(node);
|
||||
}
|
||||
},
|
||||
'TileMatrix': function(node, obj) {
|
||||
var tileMatrix = {
|
||||
'supportedCRS': obj.supportedCRS
|
||||
};
|
||||
this.readChildNodes(node, tileMatrix);
|
||||
obj['matrixIds'].push(tileMatrix);
|
||||
},
|
||||
'ScaleDenominator': function(node, obj) {
|
||||
obj['scaleDenominator'] = parseFloat(this.getChildValue(node));
|
||||
},
|
||||
'TopLeftCorner': function(node, obj) {
|
||||
var topLeftCorner = this.getChildValue(node);
|
||||
var coords = topLeftCorner.split(' ');
|
||||
var axis = ol.Projection.getFromCode(obj['supportedCRS']).getAxis();
|
||||
obj['topLeftCorner'] = ol.Coordinate.fromProjectedArray(
|
||||
[parseFloat(coords[0]), parseFloat(coords[1])], axis);
|
||||
},
|
||||
'TileWidth': function(node, obj) {
|
||||
obj['tileWidth'] = parseInt(this.getChildValue(node), 10);
|
||||
},
|
||||
'TileHeight': function(node, obj) {
|
||||
obj['tileHeight'] = parseInt(this.getChildValue(node), 10);
|
||||
},
|
||||
'MatrixWidth': function(node, obj) {
|
||||
obj['matrixWidth'] = parseInt(this.getChildValue(node), 10);
|
||||
},
|
||||
'MatrixHeight': function(node, obj) {
|
||||
obj['matrixHeight'] = parseInt(this.getChildValue(node), 10);
|
||||
},
|
||||
'ResourceURL': function(node, obj) {
|
||||
obj['resourceUrl'] = obj['resourceUrl'] || {};
|
||||
var resourceType = node.getAttribute('resourceType');
|
||||
if (!obj['resourceUrls']) {
|
||||
obj['resourceUrls'] = [];
|
||||
}
|
||||
var resourceUrl = obj['resourceUrl'][resourceType] = {
|
||||
'format': node.getAttribute('format'),
|
||||
'template': node.getAttribute('template'),
|
||||
'resourceType': resourceType
|
||||
};
|
||||
obj['resourceUrls'].push(resourceUrl);
|
||||
},
|
||||
'WSDL': function(node, obj) {
|
||||
obj['wsdl'] = {};
|
||||
obj['wsdl']['href'] = this.getAttributeNS(node,
|
||||
'http://www.w3.org/1999/xlink', 'href');
|
||||
// TODO: other attributes of <WSDL> element
|
||||
},
|
||||
'ServiceMetadataURL': function(node, obj) {
|
||||
obj['serviceMetadataUrl'] = {};
|
||||
obj['serviceMetadataUrl']['href'] =
|
||||
this.getAttributeNS(node, 'http://www.w3.org/1999/xlink', 'href');
|
||||
// TODO: other attributes of <ServiceMetadataURL> element
|
||||
},
|
||||
'LegendURL': function(node, obj) {
|
||||
obj['legend'] = {};
|
||||
obj['legend']['href'] = this.getAttributeNS(node,
|
||||
'http://www.w3.org/1999/xlink', 'href');
|
||||
obj['legend']['format'] = node.getAttribute('format');
|
||||
},
|
||||
'Dimension': function(node, obj) {
|
||||
var dimension = {'values': []};
|
||||
this.readChildNodes(node, dimension);
|
||||
obj['dimensions'].push(dimension);
|
||||
},
|
||||
'Default': function(node, obj) {
|
||||
obj['default'] = this.getChildValue(node);
|
||||
},
|
||||
'Value': function(node, obj) {
|
||||
obj['values'].push(this.getChildValue(node));
|
||||
}
|
||||
}
|
||||
};
|
||||
var ows = new ol.parser.ogc.OWSCommon_v1_1_0();
|
||||
this.readers['http://www.opengis.net/ows/1.1'] =
|
||||
ows.readers['http://www.opengis.net/ows/1.1'];
|
||||
goog.base(this);
|
||||
};
|
||||
goog.inherits(ol.parser.ogc.WMTSCapabilities_v1_0_0, ol.parser.XML);
|
||||
|
||||
|
||||
/**
|
||||
* @param {string|Document|Element} data Data to read.
|
||||
* @return {Object} An object representing the document.
|
||||
*/
|
||||
ol.parser.ogc.WMTSCapabilities_v1_0_0.prototype.read = function(data) {
|
||||
if (typeof data == 'string') {
|
||||
data = goog.dom.xml.loadXml(data);
|
||||
}
|
||||
if (data && data.nodeType == 9) {
|
||||
data = data.documentElement;
|
||||
}
|
||||
var obj = {};
|
||||
this.readNode(data, obj);
|
||||
return obj;
|
||||
};
|
||||
@@ -6,6 +6,12 @@ goog.provide('ol.parser.XML');
|
||||
* @constructor
|
||||
*/
|
||||
ol.parser.XML = function() {
|
||||
this.regExes = {
|
||||
trimSpace: (/^\s*|\s*$/g),
|
||||
removeSpace: (/\s*/g),
|
||||
splitSpace: (/\s+/),
|
||||
trimComma: (/\s*,\s*/g)
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,12 @@ goog.require('ol.TransformFunction');
|
||||
ol.ENABLE_PROJ4JS = true;
|
||||
|
||||
|
||||
/**
|
||||
* @const {boolean} Have Proj4js.
|
||||
*/
|
||||
ol.HAVE_PROJ4JS = ol.ENABLE_PROJ4JS && typeof Proj4js == 'object';
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
@@ -30,8 +36,9 @@ ol.ProjectionUnits = {
|
||||
* @param {string} code Code.
|
||||
* @param {ol.ProjectionUnits} units Units.
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {string=} opt_axis Axis order.
|
||||
*/
|
||||
ol.Projection = function(code, units, extent) {
|
||||
ol.Projection = function(code, units, extent, opt_axis) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -51,6 +58,12 @@ ol.Projection = function(code, units, extent) {
|
||||
*/
|
||||
this.extent_ = extent;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
this.axis_ = opt_axis || 'enu';
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -78,6 +91,14 @@ ol.Projection.prototype.getUnits = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {string} Axis.
|
||||
*/
|
||||
ol.Projection.prototype.getAxis = function() {
|
||||
return this.axis_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -253,7 +274,7 @@ ol.Projection.addTransform = function(source, destination, transformFn) {
|
||||
*/
|
||||
ol.Projection.getFromCode = function(code) {
|
||||
var projection = ol.Projection.projections_[code];
|
||||
if (ol.Projection.isProj4jsSupported() && !goog.isDef(projection)) {
|
||||
if (ol.HAVE_PROJ4JS && !goog.isDef(projection)) {
|
||||
projection = ol.Projection.getProj4jsProjectionFromCode_(code);
|
||||
}
|
||||
if (!goog.isDef(projection)) {
|
||||
@@ -319,7 +340,7 @@ ol.Projection.getTransform = function(source, destination) {
|
||||
goog.object.containsKey(transforms[sourceCode], destinationCode)) {
|
||||
transform = transforms[sourceCode][destinationCode];
|
||||
}
|
||||
if (ol.Projection.isProj4jsSupported() && !goog.isDef(transform)) {
|
||||
if (ol.HAVE_PROJ4JS && !goog.isDef(transform)) {
|
||||
var proj4jsSource;
|
||||
if (source instanceof ol.Proj4jsProjection) {
|
||||
proj4jsSource = source;
|
||||
@@ -373,14 +394,6 @@ ol.Projection.getTransformFromCodes = function(sourceCode, destinationCode) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} True if Proj4js is available and enabled.
|
||||
*/
|
||||
ol.Projection.isProj4jsSupported = function() {
|
||||
return ol.ENABLE_PROJ4JS && 'Proj4js' in goog.global;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Coordinate} point Point.
|
||||
* @return {ol.Coordinate} Unaltered point (same reference).
|
||||
@@ -528,6 +541,7 @@ ol.Projection.EPSG_4326_EXTENT_ = new ol.Extent(-180, -90, 180, 90);
|
||||
*/
|
||||
ol.Projection.EPSG_4326_LIKE_CODES_ = [
|
||||
'CRS:84',
|
||||
'urn:ogc:def:crs:OGC:1.3:CRS84',
|
||||
'EPSG:4326',
|
||||
'urn:ogc:def:crs:EPSG:6.6:4326'
|
||||
];
|
||||
@@ -545,7 +559,9 @@ ol.Projection.EPSG_4326_LIKE_PROJECTIONS = goog.array.map(
|
||||
return new ol.Projection(
|
||||
code,
|
||||
ol.ProjectionUnits.DEGREES,
|
||||
ol.Projection.EPSG_4326_EXTENT_);
|
||||
ol.Projection.EPSG_4326_EXTENT_,
|
||||
code === 'CRS:84' || code === 'urn:ogc:def:crs:OGC:1.3:CRS84' ?
|
||||
'enu' : 'neu');
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ ol.renderer.canvas.ImageLayer.prototype.renderFrame =
|
||||
|
||||
if (!goog.isNull(this.image_)) {
|
||||
image = this.image_;
|
||||
|
||||
var imageExtent = image.getExtent();
|
||||
var imageResolution = image.getResolution();
|
||||
var transform = this.transform_;
|
||||
@@ -111,5 +112,7 @@ ol.renderer.canvas.ImageLayer.prototype.renderFrame =
|
||||
(imageExtent.minX - viewCenter.x) / imageResolution,
|
||||
(viewCenter.y - imageExtent.maxY) / imageResolution,
|
||||
0);
|
||||
|
||||
this.updateAttributions(frameState.attributions, image.getAttributions());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
goog.provide('ol.renderer.canvas.Renderer');
|
||||
goog.provide('ol.renderer.canvas.isSupported');
|
||||
goog.provide('ol.renderer.canvas.SUPPORTED');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.vec.Mat4');
|
||||
@@ -17,9 +17,10 @@ goog.require('ol.style.SymbolizerLiteral');
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Is supported.
|
||||
* @const
|
||||
* @type {boolean} Is supported.
|
||||
*/
|
||||
ol.renderer.canvas.isSupported = ol.canvas.isSupported;
|
||||
ol.renderer.canvas.SUPPORTED = ol.canvas.SUPPORTED;
|
||||
|
||||
|
||||
|
||||
@@ -291,4 +292,3 @@ ol.renderer.canvas.Renderer.renderShape = function(shape) {
|
||||
}
|
||||
return canvas;
|
||||
};
|
||||
|
||||
|
||||
@@ -106,6 +106,8 @@ ol.renderer.dom.ImageLayer.prototype.renderFrame =
|
||||
this.image_ = image;
|
||||
}
|
||||
this.setTransform(transform);
|
||||
|
||||
this.updateAttributions(frameState.attributions, image.getAttributions());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
goog.provide('ol.renderer.dom.isSupported');
|
||||
|
||||
goog.require('goog.functions');
|
||||
goog.provide('ol.renderer.dom.SUPPORTED');
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Is supported.
|
||||
* @const
|
||||
* @type {boolean} Is supported.
|
||||
*/
|
||||
ol.renderer.dom.isSupported = goog.functions.TRUE;
|
||||
ol.renderer.dom.SUPPORTED = true;
|
||||
|
||||
@@ -2,6 +2,7 @@ goog.provide('ol.renderer.Layer');
|
||||
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.FrameState');
|
||||
goog.require('ol.Image');
|
||||
goog.require('ol.ImageState');
|
||||
@@ -201,6 +202,23 @@ ol.renderer.Layer.prototype.scheduleExpireCache =
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {Object.<string, ol.Attribution>} attributionsSet Attributions
|
||||
* set (target).
|
||||
* @param {Array.<ol.Attribution>} attributions Attributions (source).
|
||||
*/
|
||||
ol.renderer.Layer.prototype.updateAttributions =
|
||||
function(attributionsSet, attributions) {
|
||||
var i;
|
||||
var attribution;
|
||||
for (i = 0; i < attributions.length; ++i) {
|
||||
attribution = attributions[i];
|
||||
attributionsSet[goog.getUid(attribution).toString()] = attribution;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {Object.<string, Object.<string, ol.TileRange>>} usedTiles Used tiles.
|
||||
|
||||
@@ -198,6 +198,8 @@ ol.renderer.webgl.ImageLayer.prototype.renderFrame =
|
||||
|
||||
this.image_ = image;
|
||||
this.texture_ = texture;
|
||||
|
||||
this.updateAttributions(frameState.attributions, image.getAttributions());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
goog.provide('ol.renderer.webgl.isSupported');
|
||||
goog.provide('ol.renderer.webgl.SUPPORTED');
|
||||
|
||||
goog.require('ol.webgl');
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Is supported.
|
||||
* @const
|
||||
* @type {boolean} Is supported.
|
||||
*/
|
||||
ol.renderer.webgl.isSupported = ol.webgl.isSupported;
|
||||
ol.renderer.webgl.SUPPORTED = ol.webgl.SUPPORTED;
|
||||
|
||||
@@ -84,7 +84,8 @@ ol.source.ImageSource.prototype.createImage =
|
||||
var imageUrl = this.imageUrlFunction(extent, size);
|
||||
if (goog.isDef(imageUrl)) {
|
||||
image = new ol.Image(
|
||||
extent, resolution, imageUrl, this.crossOrigin_);
|
||||
extent, resolution, imageUrl, this.crossOrigin_,
|
||||
this.getAttributions());
|
||||
}
|
||||
return image;
|
||||
};
|
||||
|
||||
@@ -42,13 +42,6 @@ ol.tilegrid.TileGrid = function(tileGridOptions) {
|
||||
*/
|
||||
this.numResolutions_ = this.resolutions_.length;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Extent}
|
||||
*/
|
||||
this.extent_ = goog.isDef(tileGridOptions.extent) ?
|
||||
tileGridOptions.extent : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Coordinate}
|
||||
@@ -98,14 +91,6 @@ ol.tilegrid.TileGrid.prototype.forEachTileCoordParentTileRange =
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
ol.tilegrid.TileGrid.prototype.getExtent = function() {
|
||||
return this.extent_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} z Z.
|
||||
* @return {ol.Coordinate} Origin.
|
||||
@@ -183,10 +168,10 @@ ol.tilegrid.TileGrid.prototype.getTileRangeExtent = function(z, tileRange) {
|
||||
*/
|
||||
ol.tilegrid.TileGrid.prototype.getTileRangeForExtentAndResolution = function(
|
||||
extent, resolution) {
|
||||
var min = this.getTileCoordForCoordAndResolution(
|
||||
var min = this.getTileCoordForCoordAndResolution_(
|
||||
new ol.Coordinate(extent.minX, extent.minY), resolution);
|
||||
var max = this.getTileCoordForCoordAndResolution(
|
||||
new ol.Coordinate(extent.maxX, extent.maxY), resolution);
|
||||
var max = this.getTileCoordForCoordAndResolution_(
|
||||
new ol.Coordinate(extent.maxX, extent.maxY), resolution, true);
|
||||
return new ol.TileRange(min.x, min.y, max.x, max.y);
|
||||
};
|
||||
|
||||
@@ -233,46 +218,48 @@ ol.tilegrid.TileGrid.prototype.getTileCoordExtent = function(tileCoord) {
|
||||
|
||||
|
||||
/**
|
||||
* Get the tile coordinate for the given map coordinate and resolution. This
|
||||
* method considers that coordinates that intersect tile boundaries should be
|
||||
* assigned the higher tile coordinate.
|
||||
*
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @param {number} resolution Resolution.
|
||||
* @return {ol.TileCoord} Tile coordinate.
|
||||
*/
|
||||
ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndResolution = function(
|
||||
coordinate, resolution) {
|
||||
return this.getTileCoordForCoordAndResolution_(coordinate, resolution);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {boolean=} opt_reverseIntersectionPolicy Instead of letting edge
|
||||
* intersections go to the higher tile coordinate, let edge intersections
|
||||
* go to the lower tile coordinate.
|
||||
* @return {ol.TileCoord} Tile coordinate.
|
||||
* @private
|
||||
*/
|
||||
ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndResolution_ = function(
|
||||
coordinate, resolution, opt_reverseIntersectionPolicy) {
|
||||
var z = this.getZForResolution(resolution);
|
||||
var scale = resolution / this.getResolution(z);
|
||||
var origin = this.getOrigin(z);
|
||||
|
||||
var offsetFromOrigin = new ol.Coordinate(
|
||||
Math.floor((coordinate.x - origin.x) / resolution),
|
||||
Math.floor((coordinate.y - origin.y) / resolution));
|
||||
|
||||
var tileSize = this.getTileSize();
|
||||
tileSize = new ol.Size(tileSize.width / scale,
|
||||
tileSize.height / scale);
|
||||
|
||||
var x, y;
|
||||
x = Math.floor(offsetFromOrigin.x / tileSize.width);
|
||||
y = Math.floor(offsetFromOrigin.y / tileSize.height);
|
||||
var x = scale * (coordinate.x - origin.x) / (resolution * tileSize.width);
|
||||
var y = scale * (coordinate.y - origin.y) / (resolution * tileSize.height);
|
||||
|
||||
var tileCoord = new ol.TileCoord(z, x, y);
|
||||
var tileCoordPixelBounds = this.getPixelBoundsForTileCoordAndResolution(
|
||||
tileCoord, resolution);
|
||||
|
||||
// adjust x to allow for stretched tiles
|
||||
if (offsetFromOrigin.x < tileCoordPixelBounds.minX) {
|
||||
tileCoord.x -= 1;
|
||||
} else if (offsetFromOrigin.x >= tileCoordPixelBounds.maxX) {
|
||||
tileCoord.x += 1;
|
||||
}
|
||||
// adjust y to allow for stretched tiles
|
||||
if (offsetFromOrigin.y < tileCoordPixelBounds.minY) {
|
||||
tileCoord.y -= 1;
|
||||
} else if (offsetFromOrigin.y >= tileCoordPixelBounds.maxY) {
|
||||
tileCoord.y += 1;
|
||||
if (!opt_reverseIntersectionPolicy) {
|
||||
x = Math.floor(x);
|
||||
y = Math.floor(y);
|
||||
} else {
|
||||
x = Math.ceil(x) - 1;
|
||||
y = Math.ceil(y) - 1;
|
||||
}
|
||||
|
||||
return tileCoord;
|
||||
return new ol.TileCoord(z, x, y);
|
||||
};
|
||||
|
||||
|
||||
@@ -284,7 +271,7 @@ ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndResolution = function(
|
||||
ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndZ =
|
||||
function(coordinate, z) {
|
||||
var resolution = this.getResolution(z);
|
||||
return this.getTileCoordForCoordAndResolution(coordinate, resolution);
|
||||
return this.getTileCoordForCoordAndResolution_(coordinate, resolution);
|
||||
};
|
||||
|
||||
|
||||
@@ -333,8 +320,9 @@ ol.tilegrid.createForProjection =
|
||||
opt_tileSize : new ol.Size(ol.DEFAULT_TILE_SIZE, ol.DEFAULT_TILE_SIZE);
|
||||
var resolutions = new Array(maxZoom + 1);
|
||||
goog.asserts.assert(tileSize.width == tileSize.height);
|
||||
size = size / tileSize.width;
|
||||
for (var z = 0, zz = resolutions.length; z < zz; ++z) {
|
||||
resolutions[z] = size / (tileSize.width << z);
|
||||
resolutions[z] = size / Math.pow(2, z);
|
||||
}
|
||||
return new ol.tilegrid.TileGrid({
|
||||
origin: projectionExtent.getTopLeft(),
|
||||
|
||||
@@ -17,9 +17,9 @@ ol.tilegrid.XYZ = function(xyzOptions) {
|
||||
|
||||
var resolutions = new Array(xyzOptions.maxZoom + 1);
|
||||
var z;
|
||||
var size = 2 * ol.Projection.EPSG_3857_HALF_SIZE / ol.DEFAULT_TILE_SIZE;
|
||||
for (z = 0; z <= xyzOptions.maxZoom; ++z) {
|
||||
resolutions[z] =
|
||||
2 * ol.Projection.EPSG_3857_HALF_SIZE / (ol.DEFAULT_TILE_SIZE << z);
|
||||
resolutions[z] = size / Math.pow(2, z);
|
||||
}
|
||||
|
||||
goog.base(this, {
|
||||
|
||||
@@ -7,6 +7,9 @@ goog.require('ol.TileCoord');
|
||||
|
||||
|
||||
/**
|
||||
* A representation of a contiguous block of tiles. A tile range is specified
|
||||
* by its min/max tile coordinates and is inclusive of coordinates.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {ol.Rectangle}
|
||||
* @param {number} minX Minimum X.
|
||||
@@ -15,7 +18,27 @@ goog.require('ol.TileCoord');
|
||||
* @param {number} maxY Maximum Y.
|
||||
*/
|
||||
ol.TileRange = function(minX, minY, maxX, maxY) {
|
||||
goog.base(this, minX, minY, maxX, maxY);
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.minX = minX;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.minY = minY;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.maxX = maxX;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.maxY = maxY;
|
||||
|
||||
};
|
||||
goog.inherits(ol.TileRange, ol.Rectangle);
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ ol.View2D = function(opt_view2DOptions) {
|
||||
projectionExtent.maxX - projectionExtent.minX,
|
||||
projectionExtent.maxY - projectionExtent.minY);
|
||||
values[ol.View2DProperty.RESOLUTION] =
|
||||
size / (ol.DEFAULT_TILE_SIZE << view2DOptions.zoom);
|
||||
size / (ol.DEFAULT_TILE_SIZE * Math.pow(2, view2DOptions.zoom));
|
||||
}
|
||||
values[ol.View2DProperty.ROTATION] = view2DOptions.rotation;
|
||||
this.setValues(values);
|
||||
|
||||
@@ -45,9 +45,10 @@ ol.webgl.getContext = function(canvas, opt_attributes) {
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Is supported.
|
||||
* @const
|
||||
* @type {boolean} Is supported.
|
||||
*/
|
||||
ol.webgl.isSupported = function() {
|
||||
ol.webgl.SUPPORTED = (function() {
|
||||
if (!('WebGLRenderingContext' in goog.global)) {
|
||||
return false;
|
||||
}
|
||||
@@ -57,4 +58,4 @@ ol.webgl.isSupported = function() {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -72,12 +72,12 @@ describe('ol.Map', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
options = {
|
||||
rotate: false,
|
||||
doubleClickZoom: false,
|
||||
dragPan: false,
|
||||
keyboard: false,
|
||||
mouseWheelZoom: false,
|
||||
shiftDragZoom: false
|
||||
rotate: false,
|
||||
doubleClickZoom: false,
|
||||
dragPan: false,
|
||||
keyboard: false,
|
||||
mouseWheelZoom: false,
|
||||
shiftDragZoom: false
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
183
test/spec/ol/parser/ogc/wmtscapabilities_v1_0_0.test.js
Normal file
183
test/spec/ol/parser/ogc/wmtscapabilities_v1_0_0.test.js
Normal file
@@ -0,0 +1,183 @@
|
||||
goog.provide('ol.test.parser.ogc.WMTSCapabilities_v1_0_0');
|
||||
|
||||
describe('ol.parser.ogc.wmtscapabilities_v1_0_0', function() {
|
||||
|
||||
var parser = new ol.parser.ogc.WMTSCapabilities();
|
||||
|
||||
describe('test ows', function() {
|
||||
it('Test ows', function() {
|
||||
var obj, serviceIdentification, serviceProvider, operationsMetadata,
|
||||
contactInfo;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmtscapabilities_v1_0_0/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
serviceIdentification = obj.serviceIdentification;
|
||||
serviceProvider = obj.serviceProvider;
|
||||
operationsMetadata = obj.operationsMetadata;
|
||||
contactInfo = serviceProvider.serviceContact.contactInfo;
|
||||
});
|
||||
});
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(serviceIdentification.title).toEqual('Web Map Tile Service');
|
||||
expect(serviceIdentification.serviceTypeVersion).toEqual('1.0.0');
|
||||
expect(serviceIdentification.serviceType.value).toEqual('OGC WMTS');
|
||||
expect(serviceProvider.providerName).toEqual('MiraMon');
|
||||
var url = 'http://www.creaf.uab.es/miramon';
|
||||
expect(serviceProvider.providerSite).toEqual(url);
|
||||
var name = 'Joan Maso Pau';
|
||||
expect(serviceProvider.serviceContact.individualName).toEqual(name);
|
||||
var position = 'Senior Software Engineer';
|
||||
expect(serviceProvider.serviceContact.positionName).toEqual(position);
|
||||
expect(contactInfo.address.administrativeArea).toEqual('Barcelona');
|
||||
expect(contactInfo.address.city).toEqual('Bellaterra');
|
||||
expect(contactInfo.address.country).toEqual('Spain');
|
||||
expect(contactInfo.address.deliveryPoint).toEqual('Fac Ciencies UAB');
|
||||
var email = 'joan.maso@uab.es';
|
||||
expect(contactInfo.address.electronicMailAddress).toEqual(email);
|
||||
expect(contactInfo.address.postalCode).toEqual('08193');
|
||||
expect(contactInfo.phone.voice).toEqual('+34 93 581 1312');
|
||||
var dcp = operationsMetadata.GetCapabilities.dcp;
|
||||
url = 'http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?';
|
||||
expect(dcp.http.get[0].url).toEqual(url);
|
||||
dcp = operationsMetadata.GetCapabilities.dcp;
|
||||
expect(dcp.http.get[0].constraints.GetEncoding.allowedValues).toEqual(
|
||||
{'KVP': true});
|
||||
url = 'http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?';
|
||||
dcp = operationsMetadata.GetFeatureInfo.dcp;
|
||||
expect(dcp.http.get[0].url).toEqual(url);
|
||||
dcp = operationsMetadata.GetFeatureInfo.dcp;
|
||||
expect(dcp.http.get[0].constraints).toBeUndefined();
|
||||
url = 'http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?';
|
||||
expect(operationsMetadata.GetTile.dcp.http.get[0].url).toEqual(url);
|
||||
dcp = operationsMetadata.GetTile.dcp;
|
||||
expect(dcp.http.get[0].constraints).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('test layers', function() {
|
||||
it('Test layers', function() {
|
||||
var obj, contents, layer, wgs84Bbox, dimensions;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmtscapabilities_v1_0_0/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
contents = obj.contents;
|
||||
layer = contents.layers[0];
|
||||
wgs84Bbox = layer.bounds;
|
||||
dimensions = layer.dimensions;
|
||||
});
|
||||
});
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(contents.layers.length).toEqual(1);
|
||||
expect(layer['abstract']).toEqual('Coastline/shorelines (BA010)');
|
||||
expect(layer.identifier).toEqual('coastlines');
|
||||
expect(layer.title).toEqual('Coastlines');
|
||||
expect(layer.formats.length).toEqual(2);
|
||||
expect(layer.formats[0]).toEqual('image/png');
|
||||
expect(layer.formats[1]).toEqual('image/gif');
|
||||
expect(layer.styles.length).toEqual(2);
|
||||
expect(layer.styles[0].identifier).toEqual('DarkBlue');
|
||||
expect(layer.styles[0].isDefault).toBeTruthy();
|
||||
expect(layer.styles[0].title).toEqual('Dark Blue');
|
||||
var url = 'http://www.miramon.uab.es/wmts/Coastlines/' +
|
||||
'coastlines_darkBlue.png';
|
||||
expect(layer.styles[0].legend.href).toEqual(url);
|
||||
expect(layer.styles[0].legend.format).toEqual('image/png');
|
||||
expect(layer.styles[1].identifier).toEqual('thickAndRed');
|
||||
expect(!layer.styles[1].isDefault).toBeTruthy();
|
||||
expect(layer.styles[1].title).toEqual('Thick And Red');
|
||||
expect(layer.styles[1].legend).toBeUndefined();
|
||||
expect(layer.tileMatrixSetLinks.length).toEqual(1);
|
||||
expect(layer.tileMatrixSetLinks[0].tileMatrixSet).toEqual('BigWorld');
|
||||
expect(wgs84Bbox instanceof ol.Extent).toBeTruthy();
|
||||
expect(wgs84Bbox.minX).toEqual(-180.0);
|
||||
expect(wgs84Bbox.maxX).toEqual(180.0);
|
||||
expect(wgs84Bbox.minY).toEqual(-90.0);
|
||||
expect(wgs84Bbox.maxY).toEqual(90.0);
|
||||
expect(layer.resourceUrl.tile.format).toEqual('image/png');
|
||||
var tpl = 'http://www.example.com/wmts/coastlines/{TileMatrix}/' +
|
||||
'{TileRow}/{TileCol}.png';
|
||||
expect(layer.resourceUrl.tile.template).toEqual(tpl);
|
||||
var format = 'application/gml+xml; version=3.1';
|
||||
expect(layer.resourceUrl.FeatureInfo.format).toEqual(format);
|
||||
tpl = 'http://www.example.com/wmts/coastlines/{TileMatrixSet}/' +
|
||||
'{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml';
|
||||
expect(layer.resourceUrl.FeatureInfo.template).toEqual(tpl);
|
||||
expect(layer.resourceUrls[0].format).toEqual('image/png');
|
||||
expect(layer.resourceUrls[0].resourceType).toEqual('tile');
|
||||
tpl = 'http://www.example.com/wmts/coastlines/{TileMatrix}/' +
|
||||
'{TileRow}/{TileCol}.png';
|
||||
expect(layer.resourceUrls[0].template).toEqual(tpl);
|
||||
format = 'application/gml+xml; version=3.1';
|
||||
expect(layer.resourceUrls[1].format).toEqual(format);
|
||||
expect(layer.resourceUrls[1].resourceType).toEqual('FeatureInfo');
|
||||
tpl = 'http://www.example.com/wmts/coastlines/{TileMatrixSet}/' +
|
||||
'{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml';
|
||||
expect(layer.resourceUrls[1].template).toEqual(tpl);
|
||||
expect(dimensions.length).toEqual(1);
|
||||
expect(dimensions[0].title).toEqual('Time');
|
||||
expect(dimensions[0]['abstract']).toEqual('Monthly datasets');
|
||||
expect(dimensions[0].identifier).toEqual('TIME');
|
||||
expect(dimensions[0]['default']).toEqual('default');
|
||||
expect(dimensions[0].values.length).toEqual(3);
|
||||
expect(dimensions[0].values[0]).toEqual('2007-05');
|
||||
expect(dimensions[0].values[1]).toEqual('2007-06');
|
||||
expect(dimensions[0].values[1]).toEqual('2007-06');
|
||||
expect(dimensions[0].values[2]).toEqual('2007-07');
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('test tileMatrixSets', function() {
|
||||
it('Test tileMatrixSets', function() {
|
||||
var obj, tileMatrixSets, bigWorld;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmtscapabilities_v1_0_0/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
tileMatrixSets = obj.contents.tileMatrixSets;
|
||||
bigWorld = tileMatrixSets['BigWorld'];
|
||||
});
|
||||
});
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(bigWorld).toBeDefined();
|
||||
expect(bigWorld.identifier).toEqual('BigWorld');
|
||||
expect(bigWorld.matrixIds.length).toEqual(2);
|
||||
expect(bigWorld.matrixIds[0].identifier).toEqual('1e6');
|
||||
expect(bigWorld.matrixIds[0].matrixHeight).toEqual(50000);
|
||||
expect(bigWorld.matrixIds[0].matrixWidth).toEqual(60000);
|
||||
expect(bigWorld.matrixIds[0].scaleDenominator).toEqual(1000000);
|
||||
expect(bigWorld.matrixIds[0].tileWidth).toEqual(256);
|
||||
expect(bigWorld.matrixIds[0].tileHeight).toEqual(256);
|
||||
expect(bigWorld.matrixIds[0].topLeftCorner.x).toEqual(-180);
|
||||
expect(bigWorld.matrixIds[0].topLeftCorner.y).toEqual(84);
|
||||
expect(bigWorld.matrixIds[1].identifier).toEqual('2.5e6');
|
||||
expect(bigWorld.matrixIds[1].matrixHeight).toEqual(7000);
|
||||
expect(bigWorld.matrixIds[1].matrixWidth).toEqual(9000);
|
||||
expect(bigWorld.matrixIds[1].scaleDenominator).toEqual(2500000);
|
||||
expect(bigWorld.matrixIds[1].tileWidth).toEqual(256);
|
||||
expect(bigWorld.matrixIds[1].tileHeight).toEqual(256);
|
||||
expect(bigWorld.matrixIds[1].topLeftCorner.x).toEqual(-180);
|
||||
expect(bigWorld.matrixIds[1].topLeftCorner.y).toEqual(84);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
goog.require('goog.net.XhrIo');
|
||||
goog.require('ol.parser.ogc.WMTSCapabilities');
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
|
||||
<ows:ServiceIdentification>
|
||||
<ows:Title>WorldTimeZones</ows:Title>
|
||||
<ows:ServiceType>OGC WMTS</ows:ServiceType>
|
||||
<ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
|
||||
</ows:ServiceIdentification>
|
||||
<ows:OperationsMetadata>
|
||||
<ows:Operation name="GetTile">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS/tile/1.0.0/">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>RESTful</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
<ows:Get xlink:href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS?">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>KVP</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
</ows:OperationsMetadata>
|
||||
<Contents>
|
||||
<Layer>
|
||||
<ows:Title>WorldTimeZones</ows:Title>
|
||||
<ows:Identifier>WorldTimeZones</ows:Identifier>
|
||||
<ows:BoundingBox crs="urn:ogc:def:crs:EPSG::102100">
|
||||
<ows:LowerCorner>-2.0037507067161843E7 -3.024097195838617E7</ows:LowerCorner>
|
||||
<ows:UpperCorner>2.0037507067161843E7 3.0240971458386205E7</ows:UpperCorner>
|
||||
</ows:BoundingBox>
|
||||
<ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
|
||||
<ows:LowerCorner>-179.99999550841463 -88.99999992161119</ows:LowerCorner>
|
||||
<ows:UpperCorner>179.99999550841463 88.99999992161118</ows:UpperCorner>
|
||||
</ows:WGS84BoundingBox>
|
||||
<Style isDefault="true">
|
||||
<ows:Title>Default Style</ows:Title>
|
||||
<ows:Identifier>default</ows:Identifier>
|
||||
</Style>
|
||||
<Format>image/png</Format>
|
||||
<TileMatrixSetLink>
|
||||
<TileMatrixSet>GoogleMapsCompatible</TileMatrixSet>
|
||||
</TileMatrixSetLink>
|
||||
<ResourceURL format="image/png" resourceType="tile" template="http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS/tile/1.0.0/WorldTimeZones/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png" />
|
||||
</Layer>
|
||||
<TileMatrixSet>
|
||||
<ows:Title>GoogleMapsCompatible</ows:Title>
|
||||
<ows:Abstract>the wellknown 'GoogleMapsCompatible' tile matrix set defined by OGC WMTS specification</ows:Abstract>
|
||||
<ows:Identifier>GoogleMapsCompatible</ows:Identifier>
|
||||
<ows:SupportedCRS>urn:ogc:def:crs:EPSG:6.18:3:3857</ows:SupportedCRS>
|
||||
<WellKnownScaleSet>urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible</WellKnownScaleSet>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>5</ows:Identifier>
|
||||
<ScaleDenominator>17471320.75089743</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34278925 20037508.34278925</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>32</MatrixWidth>
|
||||
<MatrixHeight>32</MatrixHeight>
|
||||
</TileMatrix>
|
||||
</TileMatrixSet>
|
||||
</Contents>
|
||||
<ServiceMetadataURL xlink:href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS/1.0.0/WMTSCapabilities.xml" />
|
||||
</Capabilities>
|
||||
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
|
||||
<ows:OperationsMetadata>
|
||||
<ows:Operation name="GetCapabilities">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/1.0.0/WMTSCapabilities.xml">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>REST</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
<ows:Operation name="GetTile">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/rest">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>REST</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
<ows:Get xlink:href="http://wmts1.geo.admin.ch/rest">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>REST</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/kvp">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>KVP</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
<ows:Get xlink:href="http://wmts1.geo.admin.ch/kvp">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>KVP</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
</ows:OperationsMetadata>
|
||||
<Contents>
|
||||
<Layer>
|
||||
<ows:Title>Agglomérations et villes isolées</ows:Title>
|
||||
<ows:Abstract>Les agglomérations et villes isolées (communes non rattachées à une agglomération et comptant au moins 10`000 habitants) font partie des régions d’analyse de la statistique suisse. Ce niveau géographique est défini depuis plus de 100 ans, afin de mesurer l’urbanisation, phénomène fondamental structurant l’organisation du territoire. Sa fonction principale est de permettre une comparaison spatiale entre des espaces urbains inégalement délimités sur le plan institutionnel. Une version ancienne est appliquée pour la première fois en 1930, puis révisée en 1984 et 1990, toujours sur la base des recensements de la population. La version actuelle classe les 2896 communes de Suisse (état 2000) selon leur appartenance ou pas à une agglomération ou ville isolée en fonction de critères statistiques (Etat et évolution de la population, lien de continuité de la zone bâtie, rapport entre population active occupée et population résidante, structure économique et flux de pendulaires). Les agglomérations et les villes isolées forment l`espace urbain, les territoires restant l`espace rural. La définition des agglomérations de l’OFS n’a pas valeur d’obligation légale.</ows:Abstract>
|
||||
<ows:WGS84BoundingBox>
|
||||
<ows:LowerCorner>5.140242 45.398181</ows:LowerCorner>
|
||||
<ows:UpperCorner>11.47757 48.230651</ows:UpperCorner>
|
||||
</ows:WGS84BoundingBox>
|
||||
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
|
||||
<ows:Metadata xlink:href="http://www.swisstopo.admin.ch/SITiled/world/AdminBoundaries/metadata.htm"/>
|
||||
<Style>
|
||||
<ows:Title>Agglomérations et villes isolées</ows:Title>
|
||||
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
|
||||
<LegendURL format="image/png" xlink:href="http://api.geo.admin.ch/legend/ch.are.agglomerationen_isolierte_staedte-2000_fr.png" />
|
||||
</Style>
|
||||
<Format>image/png</Format>
|
||||
<Dimension>
|
||||
<ows:Identifier>Time</ows:Identifier>
|
||||
<Default>20090101</Default>
|
||||
<Value>20090101</Value>
|
||||
</Dimension>
|
||||
<TileMatrixSetLink>
|
||||
<TileMatrixSet>21781</TileMatrixSet>
|
||||
</TileMatrixSetLink>
|
||||
</Layer>
|
||||
<TileMatrixSet>
|
||||
<ows:Identifier>21781</ows:Identifier>
|
||||
<ows:SupportedCRS>urn:ogc:def:crs:EPSG:1.0:21781</ows:SupportedCRS>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>0</ows:Identifier>
|
||||
<ScaleDenominator>14285750.5715</ScaleDenominator>
|
||||
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>1</MatrixWidth>
|
||||
<MatrixHeight>1</MatrixHeight>
|
||||
</TileMatrix>
|
||||
</TileMatrixSet>
|
||||
</Contents>
|
||||
<ServiceMetadataURL xlink:href="http://www.opengis.uab.es/SITiled/world/1.0.0/WMTSCapabilities.xml"/>
|
||||
</Capabilities>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
|
||||
<ows:OperationsMetadata>
|
||||
<ows:Operation name="GetCapabilities">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/1.0.0/WMTSCapabilities.xml">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>REST</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
<ows:Operation name="GetTile">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/kvp">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>KVP</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/rest">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>REST</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
</ows:OperationsMetadata>
|
||||
<Contents>
|
||||
<Layer>
|
||||
<ows:Title>Agglomérations et villes isolées</ows:Title>
|
||||
<ows:Abstract>Les agglomérations et villes isolées (communes non rattachées à une agglomération et comptant au moins 10`000 habitants) font partie des régions d’analyse de la statistique suisse. Ce niveau géographique est défini depuis plus de 100 ans, afin de mesurer l’urbanisation, phénomène fondamental structurant l’organisation du territoire. Sa fonction principale est de permettre une comparaison spatiale entre des espaces urbains inégalement délimités sur le plan institutionnel. Une version ancienne est appliquée pour la première fois en 1930, puis révisée en 1984 et 1990, toujours sur la base des recensements de la population. La version actuelle classe les 2896 communes de Suisse (état 2000) selon leur appartenance ou pas à une agglomération ou ville isolée en fonction de critères statistiques (Etat et évolution de la population, lien de continuité de la zone bâtie, rapport entre population active occupée et population résidante, structure économique et flux de pendulaires). Les agglomérations et les villes isolées forment l`espace urbain, les territoires restant l`espace rural. La définition des agglomérations de l’OFS n’a pas valeur d’obligation légale.</ows:Abstract>
|
||||
<ows:WGS84BoundingBox>
|
||||
<ows:LowerCorner>5.140242 45.398181</ows:LowerCorner>
|
||||
<ows:UpperCorner>11.47757 48.230651</ows:UpperCorner>
|
||||
</ows:WGS84BoundingBox>
|
||||
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
|
||||
<ows:Metadata xlink:href="http://www.swisstopo.admin.ch/SITiled/world/AdminBoundaries/metadata.htm"/>
|
||||
<Style>
|
||||
<ows:Title>Agglomérations et villes isolées</ows:Title>
|
||||
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
|
||||
<LegendURL format="image/png" xlink:href="http://api.geo.admin.ch/legend/ch.are.agglomerationen_isolierte_staedte-2000_fr.png" />
|
||||
</Style>
|
||||
<Format>image/png</Format>
|
||||
<Dimension>
|
||||
<ows:Identifier>Time</ows:Identifier>
|
||||
<Default>20090101</Default>
|
||||
<Value>20090101</Value>
|
||||
</Dimension>
|
||||
<TileMatrixSetLink>
|
||||
<TileMatrixSet>21781</TileMatrixSet>
|
||||
</TileMatrixSetLink>
|
||||
</Layer>
|
||||
<TileMatrixSet>
|
||||
<ows:Identifier>21781</ows:Identifier>
|
||||
<ows:SupportedCRS>urn:ogc:def:crs:EPSG:1.0:21781</ows:SupportedCRS>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>0</ows:Identifier>
|
||||
<ScaleDenominator>14285750.5715</ScaleDenominator>
|
||||
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>1</MatrixWidth>
|
||||
<MatrixHeight>1</MatrixHeight>
|
||||
</TileMatrix>
|
||||
</TileMatrixSet>
|
||||
</Contents>
|
||||
<ServiceMetadataURL xlink:href="http://www.opengis.uab.es/SITiled/world/1.0.0/WMTSCapabilities.xml"/>
|
||||
</Capabilities>
|
||||
@@ -0,0 +1,158 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
|
||||
<ows:ServiceIdentification>
|
||||
<ows:Title>Web Map Tile Service</ows:Title>
|
||||
<ows:Abstract>Service that contrains the map access interface to some TileMatrixSets</ows:Abstract>
|
||||
<ows:Keywords>
|
||||
<ows:Keyword>tile</ows:Keyword>
|
||||
<ows:Keyword>tile matrix set</ows:Keyword>
|
||||
<ows:Keyword>map</ows:Keyword>
|
||||
</ows:Keywords>
|
||||
<ows:ServiceType>OGC WMTS</ows:ServiceType>
|
||||
<ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
|
||||
<ows:Fees>none</ows:Fees>
|
||||
<ows:AccessConstraints>none</ows:AccessConstraints>
|
||||
</ows:ServiceIdentification>
|
||||
<ows:ServiceProvider>
|
||||
<ows:ProviderName>MiraMon</ows:ProviderName>
|
||||
<ows:ProviderSite xlink:href="http://www.creaf.uab.es/miramon"/>
|
||||
<ows:ServiceContact>
|
||||
<ows:IndividualName>Joan Maso Pau</ows:IndividualName>
|
||||
<ows:PositionName>Senior Software Engineer</ows:PositionName>
|
||||
<ows:ContactInfo>
|
||||
<ows:Phone>
|
||||
<ows:Voice>+34 93 581 1312</ows:Voice>
|
||||
<ows:Facsimile>+34 93 581 4151</ows:Facsimile>
|
||||
</ows:Phone>
|
||||
<ows:Address>
|
||||
<ows:DeliveryPoint>Fac Ciencies UAB</ows:DeliveryPoint>
|
||||
<ows:City>Bellaterra</ows:City>
|
||||
<ows:AdministrativeArea>Barcelona</ows:AdministrativeArea>
|
||||
<ows:PostalCode>08193</ows:PostalCode>
|
||||
<ows:Country>Spain</ows:Country>
|
||||
<ows:ElectronicMailAddress>joan.maso@uab.es</ows:ElectronicMailAddress>
|
||||
</ows:Address>
|
||||
</ows:ContactInfo>
|
||||
</ows:ServiceContact>
|
||||
</ows:ServiceProvider>
|
||||
<ows:OperationsMetadata>
|
||||
<ows:Operation name="GetCapabilities">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>KVP</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
<ows:Operation name="GetTile">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?"/>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
<ows:Operation name="GetFeatureInfo">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?"/>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
</ows:OperationsMetadata>
|
||||
<Contents>
|
||||
<Layer>
|
||||
<ows:Title>Coastlines</ows:Title>
|
||||
<ows:Abstract>Coastline/shorelines (BA010)</ows:Abstract>
|
||||
<ows:WGS84BoundingBox>
|
||||
<ows:LowerCorner>-180 -90</ows:LowerCorner>
|
||||
<ows:UpperCorner>180 90</ows:UpperCorner>
|
||||
</ows:WGS84BoundingBox>
|
||||
<ows:Identifier>coastlines</ows:Identifier>
|
||||
<ResourceURL format="image/png" resourceType="tile"
|
||||
template="http://www.example.com/wmts/coastlines/{TileMatrix}/{TileRow}/{TileCol}.png" />
|
||||
<ResourceURL format="application/gml+xml; version=3.1" resourceType="FeatureInfo"
|
||||
template="http://www.example.com/wmts/coastlines/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml" />
|
||||
<Style isDefault="true">
|
||||
<ows:Title>Dark Blue</ows:Title>
|
||||
<ows:Identifier>DarkBlue</ows:Identifier>
|
||||
<LegendURL format="image/png" xlink:href="http://www.miramon.uab.es/wmts/Coastlines/coastlines_darkBlue.png"/>
|
||||
</Style>
|
||||
<Style>
|
||||
<ows:Title>Thick And Red</ows:Title>
|
||||
<ows:Abstract>Specify this style if you want your maps to have thick red coastlines.
|
||||
</ows:Abstract>
|
||||
<ows:Identifier>thickAndRed</ows:Identifier>
|
||||
</Style>
|
||||
<Format>image/png</Format>
|
||||
<Format>image/gif</Format>
|
||||
<Dimension>
|
||||
<ows:Title>Time</ows:Title>
|
||||
<ows:Abstract>Monthly datasets</ows:Abstract>
|
||||
<ows:Identifier>TIME</ows:Identifier>
|
||||
<Value>2007-05</Value>
|
||||
<Value>2007-06</Value>
|
||||
<Value>2007-07</Value>
|
||||
<Default>default</Default>
|
||||
</Dimension>
|
||||
<TileMatrixSetLink>
|
||||
<TileMatrixSet>BigWorld</TileMatrixSet>
|
||||
</TileMatrixSetLink>
|
||||
</Layer>
|
||||
<TileMatrixSet>
|
||||
<ows:Identifier>BigWorld</ows:Identifier>
|
||||
<ows:SupportedCRS>urn:ogc:def:crs:OGC:1.3:CRS84</ows:SupportedCRS>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>1e6</ows:Identifier>
|
||||
<ScaleDenominator>1e6</ScaleDenominator>
|
||||
<TopLeftCorner>-180 84</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>60000</MatrixWidth>
|
||||
<MatrixHeight>50000</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>2.5e6</ows:Identifier>
|
||||
<ScaleDenominator>2.5e6</ScaleDenominator>
|
||||
<TopLeftCorner>-180 84</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>9000</MatrixWidth>
|
||||
<MatrixHeight>7000</MatrixHeight>
|
||||
</TileMatrix>
|
||||
</TileMatrixSet>
|
||||
</Contents>
|
||||
<Themes>
|
||||
<Theme>
|
||||
<ows:Title>Foundation</ows:Title>
|
||||
<ows:Abstract>"Digital Chart Of The World" data</ows:Abstract>
|
||||
<ows:Identifier>Foundation</ows:Identifier>
|
||||
<Theme>
|
||||
<ows:Title>Boundaries</ows:Title>
|
||||
<ows:Identifier>Boundaries</ows:Identifier>
|
||||
<LayerRef>coastlines</LayerRef>
|
||||
<LayerRef>politicalBoundaries</LayerRef>
|
||||
<LayerRef>depthContours</LayerRef>
|
||||
</Theme>
|
||||
<Theme>
|
||||
<ows:Title>Transportation</ows:Title>
|
||||
<ows:Identifier>Transportation</ows:Identifier>
|
||||
<LayerRef>roads</LayerRef>
|
||||
<LayerRef>railroads</LayerRef>
|
||||
<LayerRef>airports</LayerRef>
|
||||
</Theme>
|
||||
</Theme>
|
||||
<Theme>
|
||||
<ows:Title>World Geology</ows:Title>
|
||||
<ows:Identifier>World Geology</ows:Identifier>
|
||||
<LayerRef>worldAgeRockType</LayerRef>
|
||||
<LayerRef>worldFaultLines</LayerRef>
|
||||
<LayerRef>felsicMagmatic</LayerRef>
|
||||
<LayerRef>maficMagmatic</LayerRef>
|
||||
</Theme>
|
||||
</Themes>
|
||||
</Capabilities>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
|
||||
<ows:OperationsMetadata>
|
||||
<ows:Operation name="GetCapabilities">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/1.0.0/WMTSCapabilities.xml">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>REST</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
<ows:Operation name="GetTile">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>REST</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
</ows:OperationsMetadata>
|
||||
<Contents>
|
||||
<Layer>
|
||||
<ows:Title>Agglomérations et villes isolées</ows:Title>
|
||||
<ows:Abstract>Les agglomérations et villes isolées (communes non rattachées à une agglomération et comptant au moins 10`000 habitants) font partie des régions d’analyse de la statistique suisse. Ce niveau géographique est défini depuis plus de 100 ans, afin de mesurer l’urbanisation, phénomène fondamental structurant l’organisation du territoire. Sa fonction principale est de permettre une comparaison spatiale entre des espaces urbains inégalement délimités sur le plan institutionnel. Une version ancienne est appliquée pour la première fois en 1930, puis révisée en 1984 et 1990, toujours sur la base des recensements de la population. La version actuelle classe les 2896 communes de Suisse (état 2000) selon leur appartenance ou pas à une agglomération ou ville isolée en fonction de critères statistiques (Etat et évolution de la population, lien de continuité de la zone bâtie, rapport entre population active occupée et population résidante, structure économique et flux de pendulaires). Les agglomérations et les villes isolées forment l`espace urbain, les territoires restant l`espace rural. La définition des agglomérations de l’OFS n’a pas valeur d’obligation légale.</ows:Abstract>
|
||||
<ows:WGS84BoundingBox>
|
||||
<ows:LowerCorner>5.140242 45.398181</ows:LowerCorner>
|
||||
<ows:UpperCorner>11.47757 48.230651</ows:UpperCorner>
|
||||
</ows:WGS84BoundingBox>
|
||||
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
|
||||
<ows:Metadata xlink:href="http://www.swisstopo.admin.ch/SITiled/world/AdminBoundaries/metadata.htm"/>
|
||||
<Style>
|
||||
<ows:Title>Agglomérations et villes isolées</ows:Title>
|
||||
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
|
||||
<LegendURL format="image/png" xlink:href="http://api.geo.admin.ch/legend/ch.are.agglomerationen_isolierte_staedte-2000_fr.png" />
|
||||
</Style>
|
||||
<Format>image/png</Format>
|
||||
<Dimension>
|
||||
<ows:Identifier>Time</ows:Identifier>
|
||||
<Default>20090101</Default>
|
||||
<Value>20090101</Value>
|
||||
</Dimension>
|
||||
<TileMatrixSetLink>
|
||||
<TileMatrixSet>21781</TileMatrixSet>
|
||||
</TileMatrixSetLink>
|
||||
<ResourceURL format="image/png" resourceType="tile" template="http://wmts.geo.admin.ch/1.0.0/ch.are.agglomerationen_isolierte_staedte-2000/default/{Time}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"/>
|
||||
</Layer>
|
||||
<TileMatrixSet>
|
||||
<ows:Identifier>21781</ows:Identifier>
|
||||
<ows:SupportedCRS>urn:ogc:def:crs:EPSG:21781</ows:SupportedCRS>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>0</ows:Identifier>
|
||||
<ScaleDenominator>14285750.5715</ScaleDenominator>
|
||||
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>1</MatrixWidth>
|
||||
<MatrixHeight>1</MatrixHeight>
|
||||
</TileMatrix>
|
||||
</TileMatrixSet>
|
||||
</Contents>
|
||||
<ServiceMetadataURL xlink:href="http://www.opengis.uab.es/SITiled/world/1.0.0/WMTSCapabilities.xml"/>
|
||||
</Capabilities>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
|
||||
<ows:OperationsMetadata>
|
||||
<ows:Operation name="GetCapabilities">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/1.0.0/WMTSCapabilities.xml">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>REST</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
<ows:Operation name="GetTile">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>REST</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
</ows:OperationsMetadata>
|
||||
<Contents>
|
||||
<Layer>
|
||||
<ows:Title>Agglomérations et villes isolées</ows:Title>
|
||||
<ows:Abstract>Les agglomérations et villes isolées (communes non rattachées à une agglomération et comptant au moins 10`000 habitants) font partie des régions d’analyse de la statistique suisse. Ce niveau géographique est défini depuis plus de 100 ans, afin de mesurer l’urbanisation, phénomène fondamental structurant l’organisation du territoire. Sa fonction principale est de permettre une comparaison spatiale entre des espaces urbains inégalement délimités sur le plan institutionnel. Une version ancienne est appliquée pour la première fois en 1930, puis révisée en 1984 et 1990, toujours sur la base des recensements de la population. La version actuelle classe les 2896 communes de Suisse (état 2000) selon leur appartenance ou pas à une agglomération ou ville isolée en fonction de critères statistiques (Etat et évolution de la population, lien de continuité de la zone bâtie, rapport entre population active occupée et population résidante, structure économique et flux de pendulaires). Les agglomérations et les villes isolées forment l`espace urbain, les territoires restant l`espace rural. La définition des agglomérations de l’OFS n’a pas valeur d’obligation légale.</ows:Abstract>
|
||||
<ows:WGS84BoundingBox>
|
||||
<ows:LowerCorner>5.140242 45.398181</ows:LowerCorner>
|
||||
<ows:UpperCorner>11.47757 48.230651</ows:UpperCorner>
|
||||
</ows:WGS84BoundingBox>
|
||||
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
|
||||
<ows:Metadata xlink:href="http://www.swisstopo.admin.ch/SITiled/world/AdminBoundaries/metadata.htm"/>
|
||||
<Style>
|
||||
<ows:Title>Agglomérations et villes isolées</ows:Title>
|
||||
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
|
||||
<LegendURL format="image/png" xlink:href="http://api.geo.admin.ch/legend/ch.are.agglomerationen_isolierte_staedte-2000_fr.png" />
|
||||
</Style>
|
||||
<Format>image/png</Format>
|
||||
<Dimension>
|
||||
<ows:Identifier>Time</ows:Identifier>
|
||||
<Default>20090101</Default>
|
||||
<Value>20090101</Value>
|
||||
</Dimension>
|
||||
<TileMatrixSetLink>
|
||||
<TileMatrixSet>21781</TileMatrixSet>
|
||||
</TileMatrixSetLink>
|
||||
<ResourceURL format="image/png" resourceType="tile" template="http://wmts.geo.admin.ch/1.0.0/ch.are.agglomerationen_isolierte_staedte-2000/default/{Time}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"/>
|
||||
</Layer>
|
||||
<TileMatrixSet>
|
||||
<ows:Identifier>21781</ows:Identifier>
|
||||
<ows:SupportedCRS>urn:ogc:def:crs:EPSG:1.0:21781</ows:SupportedCRS>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>0</ows:Identifier>
|
||||
<ScaleDenominator>14285750.5715</ScaleDenominator>
|
||||
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>1</MatrixWidth>
|
||||
<MatrixHeight>1</MatrixHeight>
|
||||
</TileMatrix>
|
||||
</TileMatrixSet>
|
||||
</Contents>
|
||||
<ServiceMetadataURL xlink:href="http://www.opengis.uab.es/SITiled/world/1.0.0/WMTSCapabilities.xml"/>
|
||||
</Capabilities>
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
|
||||
<ows:ServiceIdentification>
|
||||
<ows:Title>Federal Geodata Infrastructure of Switzerland</ows:Title>
|
||||
<ows:Abstract>Some Geodata are subject to license and fees</ows:Abstract>
|
||||
<ows:Keywords>
|
||||
<ows:Keyword>FGDI</ows:Keyword>
|
||||
<ows:Keyword>Pixelkarte</ows:Keyword>
|
||||
<ows:Keyword>Switzerland</ows:Keyword>
|
||||
</ows:Keywords>
|
||||
<ows:ServiceType>OGC WMTS</ows:ServiceType>
|
||||
<ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
|
||||
<ows:Fees>yes</ows:Fees>
|
||||
<ows:AccessConstraints>license</ows:AccessConstraints>
|
||||
</ows:ServiceIdentification>
|
||||
<ows:ServiceProvider>
|
||||
<ows:ProviderName>swisstopo</ows:ProviderName>
|
||||
<ows:ProviderSite xlink:href="http://www.swisstopo.admin.ch"/>
|
||||
<ows:ServiceContact>
|
||||
<ows:IndividualName>David Oesch</ows:IndividualName>
|
||||
<ows:PositionName></ows:PositionName>
|
||||
<ows:ContactInfo>
|
||||
<ows:Phone>
|
||||
<ows:Voice>+41 (0)31 / 963 21 11</ows:Voice>
|
||||
<ows:Facsimile>+41 (0)31 / 963 24 59</ows:Facsimile>
|
||||
</ows:Phone>
|
||||
<ows:Address>
|
||||
<ows:DeliveryPoint>swisstopo</ows:DeliveryPoint>
|
||||
<ows:City>Bern</ows:City>
|
||||
<ows:AdministrativeArea>BE</ows:AdministrativeArea>
|
||||
<ows:PostalCode>3084</ows:PostalCode>
|
||||
<ows:Country>Switzerland</ows:Country>
|
||||
<ows:ElectronicMailAddress/>
|
||||
</ows:Address>
|
||||
</ows:ContactInfo>
|
||||
</ows:ServiceContact>
|
||||
</ows:ServiceProvider>
|
||||
<ows:OperationsMetadata>
|
||||
<ows:Operation name="GetCapabilities">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/1.0.0/WMTSCapabilities.xml">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>REST</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
<ows:Operation name="GetTile">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="http://wmts.geo.admin.ch/">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>REST</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
</ows:OperationsMetadata>
|
||||
<Contents>
|
||||
<Layer>
|
||||
<ows:Title>Agglomérations et villes isolées</ows:Title>
|
||||
<ows:Abstract>Les agglomérations et villes isolées (communes non rattachées à une agglomération et comptant au moins 10`000 habitants) font partie des régions d’analyse de la statistique suisse. Ce niveau géographique est défini depuis plus de 100 ans, afin de mesurer l’urbanisation, phénomène fondamental structurant l’organisation du territoire. Sa fonction principale est de permettre une comparaison spatiale entre des espaces urbains inégalement délimités sur le plan institutionnel. Une version ancienne est appliquée pour la première fois en 1930, puis révisée en 1984 et 1990, toujours sur la base des recensements de la population. La version actuelle classe les 2896 communes de Suisse (état 2000) selon leur appartenance ou pas à une agglomération ou ville isolée en fonction de critères statistiques (Etat et évolution de la population, lien de continuité de la zone bâtie, rapport entre population active occupée et population résidante, structure économique et flux de pendulaires). Les agglomérations et les villes isolées forment l`espace urbain, les territoires restant l`espace rural. La définition des agglomérations de l’OFS n’a pas valeur d’obligation légale.</ows:Abstract>
|
||||
<ows:WGS84BoundingBox>
|
||||
<ows:LowerCorner>5.140242 45.398181</ows:LowerCorner>
|
||||
<ows:UpperCorner>11.47757 48.230651</ows:UpperCorner>
|
||||
</ows:WGS84BoundingBox>
|
||||
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
|
||||
<ows:Metadata xlink:href="http://www.swisstopo.admin.ch/SITiled/world/AdminBoundaries/metadata.htm"/>
|
||||
<Style>
|
||||
<ows:Title>Agglomérations et villes isolées</ows:Title>
|
||||
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
|
||||
<LegendURL format="image/png" xlink:href="http://api.geo.admin.ch/legend/ch.are.agglomerationen_isolierte_staedte-2000_fr.png" />
|
||||
</Style>
|
||||
<Format>image/png</Format>
|
||||
<Dimension>
|
||||
<ows:Identifier>Time</ows:Identifier>
|
||||
<Default>20090101</Default>
|
||||
<Value>20090101</Value>
|
||||
</Dimension>
|
||||
<TileMatrixSetLink>
|
||||
<TileMatrixSet>21781</TileMatrixSet>
|
||||
</TileMatrixSetLink>
|
||||
<ResourceURL format="image/png" resourceType="tile" template="http://wmts.geo.admin.ch/1.0.0/ch.are.agglomerationen_isolierte_staedte-2000/default/{Time}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"/>
|
||||
<ResourceURL format="image/png" resourceType="tile" template="http://wmts1.geo.admin.ch/1.0.0/ch.are.agglomerationen_isolierte_staedte-2000/default/{Time}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"/>
|
||||
</Layer>
|
||||
<TileMatrixSet>
|
||||
<ows:Identifier>21781</ows:Identifier>
|
||||
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>0</ows:Identifier>
|
||||
<ScaleDenominator>14285750.5715</ScaleDenominator>
|
||||
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>1</MatrixWidth>
|
||||
<MatrixHeight>1</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>8</ows:Identifier>
|
||||
<ScaleDenominator>7142875.28575</ScaleDenominator>
|
||||
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>1</MatrixWidth>
|
||||
<MatrixHeight>1</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>12</ows:Identifier>
|
||||
<ScaleDenominator>3571437.64288</ScaleDenominator>
|
||||
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>2</MatrixWidth>
|
||||
<MatrixHeight>2</MatrixHeight>
|
||||
</TileMatrix>
|
||||
</TileMatrixSet>
|
||||
</Contents>
|
||||
<ServiceMetadataURL xlink:href="http://www.opengis.uab.es/SITiled/world/1.0.0/WMTSCapabilities.xml"/>
|
||||
</Capabilities>
|
||||
@@ -94,6 +94,37 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('createForProjection', function() {
|
||||
|
||||
it('allows easier creation of a tile grid', function() {
|
||||
var projection = ol.Projection.getFromCode('EPSG:3857');
|
||||
var grid = ol.tilegrid.createForProjection(projection);
|
||||
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
||||
|
||||
var resolutions = grid.getResolutions();
|
||||
expect(resolutions.length).toBe(19);
|
||||
});
|
||||
|
||||
it('accepts a number of zoom levels', function() {
|
||||
var projection = ol.Projection.getFromCode('EPSG:3857');
|
||||
var grid = ol.tilegrid.createForProjection(projection, 22);
|
||||
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
||||
|
||||
var resolutions = grid.getResolutions();
|
||||
expect(resolutions.length).toBe(23);
|
||||
});
|
||||
|
||||
it('accepts a big number of zoom levels', function() {
|
||||
var projection = ol.Projection.getFromCode('EPSG:3857');
|
||||
var grid = ol.tilegrid.createForProjection(projection, 23);
|
||||
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
||||
|
||||
var resolutions = grid.getResolutions();
|
||||
expect(resolutions.length).toBe(24);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('getTileCoordFromCoordAndZ', function() {
|
||||
|
||||
describe('Y North, X East', function() {
|
||||
@@ -258,11 +289,11 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTileCoordForCoordAndResolution fractional', function() {
|
||||
it('returns the expected TileCoord', function() {
|
||||
var tileSize = new ol.Size(256, 256);
|
||||
|
||||
describe('getTileCoordForCoordAndResolution_', function() {
|
||||
it('returns higher tile coord for intersections by default', function() {
|
||||
var tileGrid = new ol.tilegrid.TileGrid({
|
||||
resolutions: [1 / 3],
|
||||
resolutions: resolutions,
|
||||
extent: extent,
|
||||
origin: origin,
|
||||
tileSize: tileSize
|
||||
@@ -271,91 +302,53 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
var coordinate;
|
||||
var tileCoord;
|
||||
|
||||
// These tests render at a resolution of 1. Because the layer's
|
||||
// closest resolution is 1/3, the images are scaled by 1/3.
|
||||
// In this scenario, every third tile will be one pixel wider when
|
||||
// rendered (0,0 is normal; 1,0 is wider; 0,1 is taller; etc.)
|
||||
|
||||
// gets the first tile at the origin
|
||||
// gets higher tile for edge intersection
|
||||
coordinate = new ol.Coordinate(0, 0);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, 1);
|
||||
expect(tileCoord.z).toEqual(0);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution_(
|
||||
coordinate, 100);
|
||||
expect(tileCoord.z).toEqual(3);
|
||||
expect(tileCoord.x).toEqual(0);
|
||||
expect(tileCoord.y).toEqual(0);
|
||||
|
||||
// gets the 1,0 tile at 256/3,0
|
||||
coordinate = new ol.Coordinate(256 / 3, 0);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, 1);
|
||||
expect(tileCoord.z).toEqual(0);
|
||||
expect(tileCoord.x).toEqual(1);
|
||||
expect(tileCoord.y).toEqual(0);
|
||||
// gets higher tile for edge intersection
|
||||
coordinate = new ol.Coordinate(100000, 100000);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution_(
|
||||
coordinate, 100);
|
||||
expect(tileCoord.z).toEqual(3);
|
||||
expect(tileCoord.x).toEqual(10);
|
||||
expect(tileCoord.y).toEqual(10);
|
||||
|
||||
// still gets the 1,0 tile at 512/3,0 - wider tile
|
||||
coordinate = new ol.Coordinate(512 / 3, 0);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, 1);
|
||||
expect(tileCoord.z).toEqual(0);
|
||||
expect(tileCoord.x).toEqual(1);
|
||||
expect(tileCoord.y).toEqual(0);
|
||||
|
||||
// gets the 2,0 tile at 513/3,0
|
||||
coordinate = new ol.Coordinate(513 / 3, 0);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, 1);
|
||||
expect(tileCoord.z).toEqual(0);
|
||||
expect(tileCoord.x).toEqual(2);
|
||||
expect(tileCoord.y).toEqual(0);
|
||||
|
||||
// gets the 3,0 tile at 768/3,0
|
||||
coordinate = new ol.Coordinate(768 / 3, 0);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, 1);
|
||||
expect(tileCoord.z).toEqual(0);
|
||||
expect(tileCoord.x).toEqual(3);
|
||||
expect(tileCoord.y).toEqual(0);
|
||||
|
||||
// gets the 4,0 tile at 1024/3,0
|
||||
coordinate = new ol.Coordinate(1024 / 3, 0);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, 1);
|
||||
expect(tileCoord.z).toEqual(0);
|
||||
expect(tileCoord.x).toEqual(4);
|
||||
expect(tileCoord.y).toEqual(0);
|
||||
|
||||
// still gets the 4,0 tile at 1280/3,0 - wider tile
|
||||
coordinate = new ol.Coordinate(1280 / 3, 0);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, 1);
|
||||
expect(tileCoord.z).toEqual(0);
|
||||
expect(tileCoord.x).toEqual(4);
|
||||
expect(tileCoord.y).toEqual(0);
|
||||
|
||||
// gets the 5,0 tile at 1281/3,0
|
||||
coordinate = new ol.Coordinate(1281 / 3, 0);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, 1);
|
||||
expect(tileCoord.z).toEqual(0);
|
||||
expect(tileCoord.x).toEqual(5);
|
||||
expect(tileCoord.y).toEqual(0);
|
||||
|
||||
// gets the 0,1 tile at 0,-256/3
|
||||
coordinate = new ol.Coordinate(0, -256 / 3);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, 1);
|
||||
expect(tileCoord.z).toEqual(0);
|
||||
expect(tileCoord.x).toEqual(0);
|
||||
expect(tileCoord.y).toEqual(-2);
|
||||
|
||||
// still gets the 0,1 tile at 0,-512/3 - taller tile
|
||||
coordinate = new ol.Coordinate(0, -512 / 3);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, 1);
|
||||
expect(tileCoord.z).toEqual(0);
|
||||
expect(tileCoord.x).toEqual(0);
|
||||
expect(tileCoord.y).toEqual(-2);
|
||||
});
|
||||
|
||||
it('handles alt intersection policy', function() {
|
||||
var tileGrid = new ol.tilegrid.TileGrid({
|
||||
resolutions: resolutions,
|
||||
extent: extent,
|
||||
origin: origin,
|
||||
tileSize: tileSize
|
||||
});
|
||||
|
||||
var coordinate;
|
||||
var tileCoord;
|
||||
|
||||
// can get lower tile for edge intersection
|
||||
coordinate = new ol.Coordinate(0, 0);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution_(
|
||||
coordinate, 100, true);
|
||||
expect(tileCoord.z).toEqual(3);
|
||||
expect(tileCoord.x).toEqual(-1);
|
||||
expect(tileCoord.y).toEqual(-1);
|
||||
|
||||
// gets higher tile for edge intersection
|
||||
coordinate = new ol.Coordinate(100000, 100000);
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution_(
|
||||
coordinate, 100, true);
|
||||
expect(tileCoord.z).toEqual(3);
|
||||
expect(tileCoord.x).toEqual(9);
|
||||
expect(tileCoord.y).toEqual(9);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('getTileCoordCenter', function() {
|
||||
@@ -412,6 +405,46 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTileRangeForExtentAndResolution', function() {
|
||||
it('returns the expected TileRange', function() {
|
||||
var tileGrid = new ol.tilegrid.TileGrid({
|
||||
resolutions: resolutions,
|
||||
extent: extent,
|
||||
origin: origin,
|
||||
tileSize: tileSize
|
||||
});
|
||||
var tileRange;
|
||||
|
||||
tileRange = tileGrid.getTileRangeForExtentAndResolution(extent,
|
||||
resolutions[0]);
|
||||
expect(tileRange.minY).toEqual(0);
|
||||
expect(tileRange.minX).toEqual(0);
|
||||
expect(tileRange.maxX).toEqual(0);
|
||||
expect(tileRange.maxY).toEqual(0);
|
||||
|
||||
tileRange = tileGrid.getTileRangeForExtentAndResolution(extent,
|
||||
resolutions[1]);
|
||||
expect(tileRange.minX).toEqual(0);
|
||||
expect(tileRange.minY).toEqual(0);
|
||||
expect(tileRange.maxX).toEqual(1);
|
||||
expect(tileRange.maxY).toEqual(1);
|
||||
|
||||
tileRange = tileGrid.getTileRangeForExtentAndResolution(extent,
|
||||
resolutions[2]);
|
||||
expect(tileRange.minX).toEqual(0);
|
||||
expect(tileRange.minY).toEqual(0);
|
||||
expect(tileRange.maxX).toEqual(3);
|
||||
expect(tileRange.maxY).toEqual(3);
|
||||
|
||||
tileRange = tileGrid.getTileRangeForExtentAndResolution(extent,
|
||||
resolutions[3]);
|
||||
expect(tileRange.minX).toEqual(0);
|
||||
expect(tileRange.minY).toEqual(0);
|
||||
expect(tileRange.maxX).toEqual(9);
|
||||
expect(tileRange.maxY).toEqual(9);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTileRangeForExtentAndZ', function() {
|
||||
it('returns the expected TileRange', function() {
|
||||
var tileGrid = new ol.tilegrid.TileGrid({
|
||||
|
||||
@@ -2,6 +2,20 @@ goog.provide('ol.test.TileRange');
|
||||
|
||||
describe('ol.TileRange', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
it('creates a range', function() {
|
||||
var range = new ol.TileRange(1, 2, 3, 4);
|
||||
expect(range).toBeA(ol.TileRange);
|
||||
});
|
||||
|
||||
it('can represent a range of one tile', function() {
|
||||
var range = new ol.TileRange(2, 3, 2, 3);
|
||||
expect(range).toBeA(ol.TileRange);
|
||||
expect(range.getHeight()).toBe(1);
|
||||
expect(range.getWidth()).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('contains', function() {
|
||||
it('returns the expected value', function() {
|
||||
var tileRange = new ol.TileRange(1, 1, 3, 3);
|
||||
@@ -53,6 +67,36 @@ describe('ol.TileRange', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('equals', function() {
|
||||
it('determines equivalence of two ranges', function() {
|
||||
var one = new ol.TileRange(0, 1, 2, 4);
|
||||
var same = new ol.TileRange(0, 1, 2, 4);
|
||||
var diff1 = new ol.TileRange(0, 1, 2, 5);
|
||||
var diff2 = new ol.TileRange(0, 1, 3, 4);
|
||||
var diff3 = new ol.TileRange(0, 2, 2, 4);
|
||||
var diff4 = new ol.TileRange(1, 1, 2, 4);
|
||||
expect(one.equals(same)).toBe(true);
|
||||
expect(one.equals(diff1)).toBe(false);
|
||||
expect(one.equals(diff2)).toBe(false);
|
||||
expect(one.equals(diff3)).toBe(false);
|
||||
expect(one.equals(diff4)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('extent', function() {
|
||||
it('modifies range so it includes another', function() {
|
||||
var one = new ol.TileRange(0, 1, 2, 4);
|
||||
var other = new ol.TileRange(-1, 10, -3, 12);
|
||||
one.extend(other);
|
||||
|
||||
expect(one.minX).toBe(-1);
|
||||
expect(one.minY).toBe(1);
|
||||
expect(one.maxX).toBe(2);
|
||||
expect(one.maxY).toBe(12);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
describe('getSize', function() {
|
||||
it('returns the expected size', function() {
|
||||
var tileRange = new ol.TileRange(0, 1, 2, 4);
|
||||
@@ -62,6 +106,29 @@ describe('ol.TileRange', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('intersects', function() {
|
||||
it('determines if two ranges overlap', function() {
|
||||
var one = new ol.TileRange(0, 1, 2, 4);
|
||||
var overlapsRight = new ol.TileRange(2, 1, 4, 4);
|
||||
var overlapsLeft = new ol.TileRange(-3, 1, 0, 4);
|
||||
var overlapsTop = new ol.TileRange(0, 4, 2, 5);
|
||||
var overlapsBottom = new ol.TileRange(0, -3, 2, 1);
|
||||
expect(one.intersects(overlapsLeft)).toBe(true);
|
||||
expect(one.intersects(overlapsRight)).toBe(true);
|
||||
expect(one.intersects(overlapsTop)).toBe(true);
|
||||
expect(one.intersects(overlapsBottom)).toBe(true);
|
||||
|
||||
var right = new ol.TileRange(3, 1, 5, 4);
|
||||
var left = new ol.TileRange(-3, 1, -1, 4);
|
||||
var above = new ol.TileRange(0, 5, 2, 6);
|
||||
var below = new ol.TileRange(0, -3, 2, 0);
|
||||
expect(one.intersects(right)).toBe(false);
|
||||
expect(one.intersects(left)).toBe(false);
|
||||
expect(one.intersects(above)).toBe(false);
|
||||
expect(one.intersects(below)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.TileRange');
|
||||
|
||||
Reference in New Issue
Block a user