我在 Zoomify 之前通过的图像上使用 Openlayers,因为它很大(2gb +)。除了地图之外,我还使用了一组已附加 javascript 函数的多边形。我通过“sourceFeatures.addFeature (featurePolyXY)”函数使用它们;该图像比用于创建多边形的图像略小。看到多边形是从一个包含大量值的大型 xml 文件生成的,想法是放大地图以使其与多边形保持一致,而不是修改多边形的坐标。
我想我可以通过 ol.source.Zoomify 的“大小”参数来改变地图的大小。虽然尺寸乘以 2 效果很好,但并非总是计算其他每个中间量都提出标准尺寸。看到这是我第一次使用 openlayers,我确信解决方案就在我的眼皮底下,我没有注意到它......这是我使用的代码:
//these values are taken from the ImageProperties.xml file created by
//zoomify
var imgWidth = 33165;
var imgHeight = 33165;
var url = 'imageFolder/';
var crossOrigin = 'anonymous';
var imgCenter = [imgWidth / 2, - imgHeight / 2];
var proj = new ol.proj.Projection({
code: 'ZOOMIFY',
units: 'pixels',
extent: [0, 0, imgWidth, imgHeight]
});
var source = new ol.source.Zoomify({
url: url,
//i think here is the parameter i would like to change
size: [imgWidth, imgHeight],
crossOrigin: crossOrigin
});
//MAP
var map = new ol.Map({
layers: [
new ol.layer. Tile({
source: source
}),
layerFeatures
],
target: 'map',
view: new ol.View({
projection: proj,
center: imgCenter,
zoom: 2,
extent: [0, -imgHeight, imgWidth, 0]
})
});
关于参数:size: [imgWidth, imgHeight]
我尝试输入以下值大小:[33165, 33165] => 图像根据原始大小显示大小:[66330, 66330] => 正确图像将大小加倍:[imgWidth*2, imgHeight*2 ] => 正确的图像尺寸加倍尺寸:[imgWidth*5, imgHeight*5] => 正确的图像尺寸为 *5 尺寸:[49000, 49000] => 图像按照原始尺寸磨损显示
控制台中没有给出错误。
是否有可能放大图像大小而不是两倍或倍数,而是中间方式,例如* 1.3?