commit
445f85b3e2
6 files changed
+172
-7
No files matched your search
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?><Capabilities version="1.0.0" 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"><ows:ServiceIdentification><ows:Title>Service de visualisation WMTS</ows:Title><ows:Abstract>Ce service permet la visualisation de couches de données raster IGN au travers d'un flux WMTS</ows:Abstract><ows:Keywords><ows:Keyword>Unités administratives</ows:Keyword><ows:Keyword>Limites administratives</ows:Keyword><ows:Keyword>Surfaces bâties</ows:Keyword><ows:Keyword>Réseaux de transport</ows:Keyword><ows:Keyword>Routes</ows:Keyword><ows:Keyword>Réseaux ferroviaires</ows:Keyword><ows:Keyword>Aérodromes</ows:Keyword><ows:Keyword>Réseau hydrographique</ows:Keyword><ows:Keyword>Parcelles cadastrales</ows:Keyword><ows:Keyword>Bâtiments</ows:Keyword><ows:Keyword>Services d'utilité publique et services publics</ows:Keyword><ows:Keyword>Réseaux de transport</ows:Keyword><ows:Keyword>Hydrographie</ows:Keyword><ows:Keyword>Photographies aériennes</ows:Keyword><ows:Keyword>Cartes</ows:Keyword><ows:Keyword>Cartes historiques</ows:Keyword><ows:Keyword>Altitude</ows:Keyword></ows:Keywords><ows:ServiceType>OGC WMTS</ows:ServiceType><ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion><ows:Fees>licences</ows:Fees><ows:AccessConstraints>Conditions Générales d'Utilisation disponibles ici : http://professionnels.ign.fr/sites/default/files/CGU_API_Pro.pdf</ows:AccessConstraints></ows:ServiceIdentification><ows:ServiceProvider><ows:ProviderName>IGN</ows:ProviderName><ows:ProviderSite xlink:href="" /><ows:ServiceContact><ows:IndividualName>Géoportail SAV</ows:IndividualName><ows:PositionName>custodian</ows:PositionName><ows:ContactInfo><ows:Phone><ows:Voice></ows:Voice><ows:Facsimile></ows:Facsimile></ows:Phone><ows:Address><ows:DeliveryPoint>73 avenue de Paris</ows:DeliveryPoint><ows:City>Saint Mandé</ows:City><ows:AdministrativeArea></ows:AdministrativeArea><ows:PostalCode>94160</ows:PostalCode><ows:Country>France</ows:Country><ows:ElectronicMailAddress>geop_services@geoportail.fr</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://wxs.ign.fr/cle/geoportail/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:Operation name="GetTile"><ows:DCP><ows:HTTP><ows:Get xlink:href="http://wxs.ign.fr/cle/geoportail/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>Limites administratives</ows:Title><ows:Abstract>Représentation des limites administratives (régions, départements, cantons, communes)</ows:Abstract><ows:Keywords><ows:Keyword>Unités administratives</ows:Keyword></ows:Keywords><ows:WGS84BoundingBox><ows:LowerCorner>-63.3725 -21.4756</ows:LowerCorner><ows:UpperCorner>55.9259 72.679</ows:UpperCorner></ows:WGS84BoundingBox><ows:Identifier>ADMINISTRATIVEUNITS.BOUNDARIES</ows:Identifier><Style isDefault="true"><ows:Title>Données Brutes</ows:Title><ows:Abstract>Données brutes sans changement de palette</ows:Abstract><ows:Keywords><ows:Keyword>Défaut</ows:Keyword></ows:Keywords><ows:Identifier>normal</ows:Identifier><LegendURL format="image/png" xlink:href="http://gpp3-wxs.ign.fr/static/LEGENDES/NOLEGEND.JPG" width="1" height="1" minScaleDenominator="200" maxScaleDenominator="100000000" /></Style><Format>image/png</Format><TileMatrixSetLink><TileMatrixSet>PM</TileMatrixSet><TileMatrixSetLimits><TileMatrixLimits><TileMatrix>10</TileMatrix><MinTileRow>336</MinTileRow><MaxTileRow>576</MaxTileRow><MinTileCol>336</MinTileCol><MaxTileCol>671</MaxTileCol></TileMatrixLimits><TileMatrixLimits><TileMatrix>11</TileMatrix><MinTileRow>680</MinTileRow><MaxTileRow>1152</MaxTileRow><MinTileCol>672</MinTileCol><MaxTileCol>1344</MaxTileCol></TileMatrixLimits><TileMatrixLimits><TileMatrix>12</TileMatrix><MinTileRow>1368</MinTileRow><MaxTileRow>2304</MaxTileRow><MinTileCol>1344</MinTileCol><MaxTileCol>2687</MaxTileCol></TileMatrixLimits><TileMatrixLimits><TileMatrix>13</TileMatrix><MinTileRow>2736</MinTileRow><MaxTileRow>4608</MaxTileRow><MinTileCol>2688</MinTileCol><MaxTileCol>5376</MaxTileCol></TileMatrixLimits><TileMatrixLimits><TileMatrix>14</TileMatrix><MinTileRow>5472</MinTileRow><MaxTileRow>9200</MaxTileRow><MinTileCol>5376</MinTileCol><MaxTileCol>10735</MaxTileCol></TileMatrixLimits><TileMatrixLimits><TileMatrix>15</TileMatrix><MinTileRow>10943</MinTileRow><Line truncated
|
||||
@@ -0,0 +1,64 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||
<title>IGN WMTS example</title>
|
||||
<style>
|
||||
.ol-logo ul li {
|
||||
margin-right: 3px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||
<ul class="nav pull-right">
|
||||
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div id="map" class="map"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span12">
|
||||
<h4 id="title">IGN WMTS example</h4>
|
||||
<p id="shortdesc">Demonstrates displaying IGN (France) WMTS layers.</p>
|
||||
<div id="docs">
|
||||
<p>In this example two IGN WMTS layers are displayed: <em>Ortho imagery and Cadastral parcels.</em>.
|
||||
For more information on IGN's WMTS service see the
|
||||
<a href="http://professionnels.ign.fr/api-sig">IGN Géoportail API web page</a> (french).</p>
|
||||
<p>See the <a href="wmts-ign.js" target="_blank">wmts-ign.js source</a> to see how this is done.</p>
|
||||
</div>
|
||||
<div id="tags">french, ign, geoportail, wmts</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.js" type="text/javascript"></script>
|
||||
<script src="loader.js?id=wmts-ign" type="text/javascript"></script>
|
||||
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,83 @@
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.parser.ogc.WMTSCapabilities');
|
||||
goog.require('ol.source.WMTS');
|
||||
|
||||
|
||||
// The WMTS Capabilities document includes IGNF:WGS84G as a supported
|
||||
// CRS. We include the Proj4js definition of that projection to prevent
|
||||
// Proj4js from requesting that definition from spatialreference.org.
|
||||
|
||||
Proj4js.defs['IGNF:WGS84G'] = '+title=World Geodetic System 1984 ' +
|
||||
'+proj=longlat +towgs84=0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,' +
|
||||
'0.000000 +a=6378137.0000 +rf=298.2572221010000 +units=m +no_defs <>';
|
||||
|
||||
// API key valid for "localhost" and "ol3js.org". Expiration date
|
||||
// is 21/06/2014.
|
||||
var key = 'crrypaoz7j1ifbalcobnumb0';
|
||||
|
||||
var map = new ol.Map({
|
||||
renderer: ol.RendererHint.CANVAS,
|
||||
target: 'map'
|
||||
});
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
// data/IGNWMTSCapabilities.xml downloaded from
|
||||
// http://wxs.ign.fr/cle/geoportail/wmts?SERVICE=WMTS&REQUEST=GetCapabilities
|
||||
// Stored locally because of the Same Origin Policy.
|
||||
xhr.open('GET', 'data/IGNWMTSCapabilities.xml', true);
|
||||
|
||||
|
||||
/**
|
||||
* onload handler for the XHR request.
|
||||
*/
|
||||
xhr.onload = function() {
|
||||
if (xhr.status == 200) {
|
||||
var parser = new ol.parser.ogc.WMTSCapabilities();
|
||||
var capabilities = parser.read(xhr.responseXML);
|
||||
|
||||
var wmtsUrl = 'http://wxs.ign.fr/' + key + '/geoportail/wmts';
|
||||
|
||||
var layerIdentifiers = [
|
||||
'ORTHOIMAGERY.ORTHOPHOTOS',
|
||||
'CADASTRALPARCELS.PARCELS'
|
||||
];
|
||||
var layerLogos = [
|
||||
'http://gpp3-wxs.ign.fr/static/logos/PLANETOBSERVER/PLANETOBSERVER.gif',
|
||||
'http://gpp3-wxs.ign.fr/static/logos/IGN/IGN.gif'
|
||||
];
|
||||
|
||||
var attribution = new ol.Attribution(
|
||||
'<a href="http://www.geoportail.fr/" target="_blank">' +
|
||||
'<img src="http://api.ign.fr/geoportail/api/js/latest/' +
|
||||
'theme/geoportal/img/logo_gp.gif"></a>');
|
||||
|
||||
var sourceOptions;
|
||||
var source;
|
||||
var layer;
|
||||
var i;
|
||||
|
||||
for (i = 0; i < layerIdentifiers.length; ++i) {
|
||||
sourceOptions = ol.source.WMTS.optionsFromCapabilities(
|
||||
capabilities, layerIdentifiers[i]);
|
||||
// we need to set the URL because it must include the key.
|
||||
sourceOptions.urls = [wmtsUrl];
|
||||
source = new ol.source.WMTS(sourceOptions);
|
||||
source.setAttributions([attribution]);
|
||||
source.setLogo(layerLogos[i]);
|
||||
layer = new ol.layer.TileLayer({source: source});
|
||||
map.addLayer(layer);
|
||||
}
|
||||
|
||||
var view = new ol.View2D();
|
||||
view.fitExtent([257596.65942095537, 262082.55751844167,
|
||||
6250898.984085131, 6251854.446938695], map.getSize());
|
||||
map.setView(view);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
@@ -233,7 +233,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, layer) {
|
||||
(l['resourceUrls']['tile'][format]);
|
||||
break;
|
||||
case 'KVP':
|
||||
requestEncoding = ol.source.WMTSRequestEncoding.REST;
|
||||
requestEncoding = ol.source.WMTSRequestEncoding.KVP;
|
||||
urls = [];
|
||||
goog.array.forEach(gets, function(elt, index, array) {
|
||||
if (elt['constraints']['GetEncoding']['allowedValues'].hasOwnProperty(
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
@exportClass ol.tilegrid.TileGrid ol.tilegrid.TileGridOptions
|
||||
@exportProperty ol.tilegrid.TileGrid.prototype.getResolutions
|
||||
@@ -66,15 +66,31 @@ ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet =
|
||||
var matrixIds = [];
|
||||
var origins = [];
|
||||
var tileSizes = [];
|
||||
var projection = ol.proj.get(matrixSet['supportedCRS']);
|
||||
|
||||
var supportedCRSPropName = 'supportedCRS';
|
||||
var matrixIdsPropName = 'matrixIds';
|
||||
var identifierPropName = 'identifier';
|
||||
var scaleDenominatorPropName = 'scaleDenominator';
|
||||
var topLeftCornerPropName = 'topLeftCorner';
|
||||
var tileWidthPropName = 'tileWidth';
|
||||
var tileHeightPropName = 'tileHeight';
|
||||
|
||||
var projection = ol.proj.get(matrixSet[supportedCRSPropName]);
|
||||
var metersPerUnit = projection.getMetersPerUnit();
|
||||
goog.array.forEach(matrixSet['matrixIds'], function(elt, index, array) {
|
||||
matrixIds.push(elt['identifier']);
|
||||
origins.push(elt['topLeftCorner']);
|
||||
resolutions.push(elt['scaleDenominator'] * 0.28E-3 / metersPerUnit);
|
||||
tileSizes.push([elt['tileWidth'], elt['tileHeight']]);
|
||||
|
||||
goog.array.sort(matrixSet[matrixIdsPropName], function(a, b) {
|
||||
return b[scaleDenominatorPropName] - a[scaleDenominatorPropName];
|
||||
});
|
||||
|
||||
goog.array.forEach(matrixSet[matrixIdsPropName],
|
||||
function(elt, index, array) {
|
||||
matrixIds.push(elt[identifierPropName]);
|
||||
origins.push(elt[topLeftCornerPropName]);
|
||||
resolutions.push(elt[scaleDenominatorPropName] * 0.28E-3 /
|
||||
metersPerUnit);
|
||||
tileSizes.push([elt[tileWidthPropName], elt[tileHeightPropName]]);
|
||||
});
|
||||
|
||||
return new ol.tilegrid.WMTS({
|
||||
origins: origins,
|
||||
resolutions: resolutions,
|
||||
|
||||
Reference in new issue
Block a user