Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
En OpenLayers 6.9.0 utilizo fetch WMTSCapability pero no funciona

Utilizo fetch WMTSCapabilities pero recibo este mensaje: Uncaught (en promesa) TypeError: No se pueden leer las propiedades de undefined (leyendo 'Layer') en Function.rL.source.WMTS.optionsFromCapabilities (ol.js:2)

Este es el código que uso:

 const parser = new ol.format.WMTSCapabilities(); let bgRaster; fetch('data/WMTSCapabilities.xml') .then(function (response) { return response.text(); }) .then(function (text) { const result = parser.read(text); const options = ol.source.WMTS.optionsFromCapabilities(result, { layer: 'standaard', format: 'image/png', matrixSet: 'EPSG:28992', }); bgRaster = new ol.layer.Tile({ opacity: 0.7, source: new ol.source.WMTS(options), title: 'Kadaster', visible: false }); })
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Parece que está fallando en esta línea en optionsFromCapabilities de la fuente OpenLayers :

 export function optionsFromCapabilities(wmtsCap, config) { const layers = wmtsCap['Contents']['Layer'];

Verifique que esté obteniendo un WMTSCapabilities.xml válido, incluida la etiqueta de Contents . Debería tener un aspecto similar a este xml .

about 4 years ago · Juan Pablo Isaza Report

0

Gracias, lo tengo funcionando ahora con otro enfoque, programando el origen, la extensión y la resolución de esta manera:

 const size = ol.extent.getWidth(projectionExtent) / 256; // Er zijn 20 (0 tot 19) zoomniveaus beschikbaar van de WMTS-service voor de BGT-Achtergrondkaart: let matrixIds = new Array(20); for (let z = 0; z < 10; ++z) { matrixIds[z] = 'EPSG:3857:0' + z; } for (let z = 10; z < 20; ++z) { matrixIds[z] = 'EPSG:3857:' + z; } const bgRaster = new ol.layer.Tile({ extent: projectionExtent, source: new ol.source.WMTS({ attributions: 'Kaartgegevens: &copy; <a href="https://www.kadaster.nl">Kadaster</a>', url: 'https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0?', layer: 'standaard', matrixSet: 'EPSG:3857', format: 'image/png', projection: projection, tileGrid: new ol.tilegrid.WMTS({ origin: ol.extent.getTopLeft(projectionExtent), // origin: -285401.92 + "," + 903402.0, resolutions: resolutions, matrixIds: matrixIds }), style: 'default', wrapX: false }), title: 'Kadaster', visible: true });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!