2016-05-13 296 views
3

我需要以GeoTiff格式顯示柵格圖像,並使用QGIS進行地理參考。它看起來像Openlayers 3.15不支持這種格式。你知道這件事嗎?顯示GeoTiff圖像Openlayers 3

var agentUrl = 'http://localhost:9925/Wgis/assets/img/allertaMeteoGeo.tif'; 

    var bounds = [ 713101.704, 4044061.027, 713101.704, 4044061.027]; 



    var view2 = new ol.View({ 
     center : [ -87.7302542509315, 43.744459064634 ], 
     projection : "EPSG:3857", 
     zoom : 12 
    }); 

    var sorgente = new ol.source.ImageMapGuide({ 
     projection : "EPSG:3857", 
     url : agentUrl, 
     metersPerUnit : 111319.4908, 

     imageSize: [792, 452], 
     ratio : 2 
    }); 

    var raster = new ol.layer.Image({ 
     extent : bounds, 
     source : sorgente 
    }); 

    var map2 = new ol.Map({ 
     layers : [ raster ], 
     target : 'map2', 
     view : view2 
    }); 
+0

我不認爲這是可能的,也看到在GIS這些問題SE:http://gis.stackexchange.com/questions/15095/how-to-display-a-geotiff-image-with-openlayers-at-the-right-place http://gis.stackexchange.com/questions/97943/how-to-open-geotiff-作爲底層開放層 – chrki

+0

這是仍然可用於版本4?你找到了解決方案嗎? –

回答

2

我同意chrki,它目前還無法在地圖的OpenLayers顯示TIFF(或GeoTIFF文件)的規定在這裏:https://gis.stackexchange.com/a/98029。瀏覽器本身不顯示TIFF圖像。

作爲一個實驗,我從ArcGIS柵格圖像中導出了TIFF和PNG文件。然後在地圖的OpenLayers(使用v3.18.2),我用下面的函數來成功添加一個PNG作爲ol.layer.Image,但是失敗了,恕不另行通知爲TIFF:

function addImage() { 

    extent = [-13602803.9769, 4920816.12423, -13599949.5192, 4923458.74552]; // [left, bottom, right, top] 

    var projection = new ol.proj.Projection({ 
     code: 'xkcd-image', 
     units: 'pixels', 
     extent: extent 
    }); 

    var StaticImage = new ol.layer.Image({ 
     source: new ol.source.ImageStatic({ 
     attributions: 'yada yada', 
     url: /robs/gis_data/LiDAR Elevations2.png', 
     projection: projection, 
     imageExtent: extent 
     }) 
    });  

    map.addLayer(StaticImage); 
    map.getView().fit(extent, map.getSize());  
} 
+0

這是仍然可用於版本4? –

0

其實你可以平鋪圖像之前,它加載到IIS,並從這樣的事情得到它:

var newLayer = new ol.layer.Tile({ 
source: new ol.source.OSM({ 
     url: 'maps/{z}/{x}/{y}.png' 
})});