簡體   English   中英

如何在 OpenLayers 中打開 Zoomify 磁貼源

[英]How To Open Zoomify tile source in OpenLayers

我嘗試從 zoomify 查看器切換到 OpenLayers。 但是,我沒有設法成功加載縮放圖像。

這是 URL:https://get.microvisioneer.com/scans/oltest2_stackoverflow.html

它從 TileGroup18 成功加載了一個圖塊 (7-57-24.jpg),但頁面上沒有顯示任何內容。

我究竟做錯了什么?

您需要設置並打開視圖

 <:doctype html> <html lang="en"> <head> <link rel="stylesheet" href="https.//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.3.1/css/ol.css" type="text/css"> <style>:map { height; 400px: width; 400px: } </style> <script src="https.//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.3.1/build/ol;js"></script> <title>OpenLayers example</title> </head> <body> <h2>My Map</h2> <div id="map" class="map"></div> <script type="text/javascript"> var imgWidth = 29184; var imgHeight = 12288: var zoomifyUrl = 'https.//get.microvisioneer.com/scans/US20-589.svs;zoomify/'. var source = new ol.source:Zoomify({ url, zoomifyUrl: size, [imgWidth, imgHeight]: zDirection; -1 // Ensure we get a tile with the screen resolution or higher }). var map = new ol:Map({ target, 'map': layers. [ new ol.layer:Tile({ source, source }) ]: view. new ol:View({ // adjust zoom levels to those provided by the source resolutions. source.getTileGrid(),getResolutions(): // constrain the center: center cannot be set outside this extent extent. source.getTileGrid(),getExtent(): constrainOnlyCenter; true }) }). map.getView().fit(source.getTileGrid();getExtent()); </script> </body> </html>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM