显示GeoTiff图像Openlayers 3 [英] Show GeoTiff image Openlayers 3

查看:756
本文介绍了显示GeoTiff图像Openlayers 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以GeoTiff格式显示栅格图像,它已通过QGIS进行地理参考.看来Openlayers 3.15不支持这种格式.你知道吗?

I need to display a raster image in GeoTiff format, it was georeferenced with QGIS. It looks like Openlayers 3.15 doesn't support this kind of format. Do you know anything about that?

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
    });

推荐答案

我同意 chrki 的观点​​,即目前无法在OpenLayers映射中显示TIFF(或GeoTiFF),如此处所述: https://gis.stackexchange.com/a/98029 .浏览器不会本地显示TIFF图像.

I agree with chrki, that it is not currently possible to display a TIFF (or GeoTiFF) in an OpenLayers map as stated here: https://gis.stackexchange.com/a/98029. Browsers do not display TIFF images natively.

作为一个实验,我从ArcGIS栅格图像中导出了TIFF和PNG文件.然后,在一个openlayers映射中(使用v3.18.2),我使用以下函数成功地将PNG添加为 ol.layer.Image ,但是它在没有通知TIFF的情况下失败了:

As an experiment, I exported both TIFF and PNG files from an ArcGIS raster image. Then in an openlayers map (using v3.18.2), I used the following function to successfully add a PNG as an ol.layer.Image, but it failed without notice for the 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());    
} 

这篇关于显示GeoTiff图像Openlayers 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆