以很高的缩放比例显示图块图层 [英] Show tile layer at very high zoom

查看:118
本文介绍了以很高的缩放比例显示图块图层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试显示来自GIBS图像服务器的每日MODIS卫星图像 http://wiki.earthdata.nasa.gov/display/GIBS/Map+Library+Usage . WMTS协议中提供了图块.这是我使用Google Maps API的代码的示例:

I am trying to display the daily MODIS satellite images from the GIBS image server http://wiki.earthdata.nasa.gov/display/GIBS/Map+Library+Usage. The tiles are provided in the WMTS protocol. Here is an example of my code using Google maps API:

var getTileUrl = function(tile, zoom) {
        return "http://map1.vis.earthdata.nasa.gov/wmts-webmerc/" +
               "MODIS_Terra_CorrectedReflectance_TrueColor/default/" + 
               get_date() + "/" +
               "GoogleMapsCompatible_Level9/" +
                zoom + "/" + tile.y + "/" +
                tile.x + ".jpeg";
    };

    var layerOptions = {
        alt: "MODIS_Terra_TrueColor",
        getTileUrl: getTileUrl,
        maxZoom: 9,
        minZoom: 1,
        name: "MODIS_Terra_TrueColor",
        tileSize: new google.maps.Size(256, 256),
        opacity: 0.8
    };
    var modisOverlay = new google.maps.ImageMapType(layerOptions);
    map.overlayMapTypes.insertAt(0, modisOverlay);

当我将地图缩放到比缩放级别9更多的细节时,图块消失了.因此,我将maxZoom增大到了10,现在我收到如下消息:

When I zoom the map to more detail than zoom level 9, the tiles disappear. So I increased maxZoom to a 10, and now I'm getting messages like:

Failed to load resource: the server responded with a status of 400 (Bad Request) http://map1.vis.earthdata.nasa.gov/wmts-webmerc/MODIS_Terra_CorrectedReflectance_TrueColor/default/2013-03-07/GoogleMapsCompatible_Level9/10/291/587.jpeg

据我了解,服务器没有缩放级别高于9的图块.

From my understanding the server doesn't have tiles at zoom levels higher than 9.

当我缩放到更高的缩放级别时,是否可以显示WMTS磁贴?我需要的是在用户放大到大于9的缩放级别时拉伸"切片图像.我目前正在使用Google Maps API V3,但是如果可以更方便地使用它们,则可以更改为Leaflet或OpenLayers解决我的问题.

Is there a way to show the WMTS tiles when I zoom to a higher zoom level? What I need is to "stretch" the tile images when the user zooms in to a zoom level bigger than 9. I'm currently using the Google maps API V3, but I can change to Leaflet or OpenLayers if it's easier to use them for solving my problem.

推荐答案

我找到了使用Leaflet的简单解决方案. 在Leaflet tileLayer中,我可以设置maxNativeZoom和maxZoom.

I found a simple solution using Leaflet. In the Leaflet tileLayer, I can set maxNativeZoom and maxZoom.

maxNativeZoom是切片数据提供程序支持的最大缩放级别.

maxNativeZoom is the maximum zoom level supported by the tile data provider.

maxZoom是在我的地图上显示拉伸的图块的最大缩放级别.

maxZoom is the maximum zoom level to display the stretched tiles in my map.

答案在这里:传单进一步放大并拉伸瓷砖

当我放大到maxNativeZoom以外的几个级别时,它可以工作并且看起来还可以.缺点是图像需要重新采样.

It works and looks quite OK when I zoom-in a few levels beyond the maxNativeZoom. The disadvantage is that the image is re-sampled.

这篇关于以很高的缩放比例显示图块图层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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