【问题标题】:How can I change the world view with an high quality jpg of a fantasy world in openlayer?如何在openlayer中使用幻想世界的高质量jpg改变世界观?
【发布时间】:2020-05-25 04:00:57
【问题描述】:

我尝试使用 static-image.html,但它使图像成方形,如果我放大我会失去图像的质量。我不得不说我在 html 和 css 上比 java(我从未使用过)更好,但如果有人帮助我解决这个问题,我会很高兴。

如果我想将要用作地图的图像放在文件夹中,如何从 url 更改为 src?

(window.webpackJsonp=window.webpackJsonp||[]).push([[133],{370:function(e,n,t){"use strict";t.r(n);var o=t(3),c=t(2),i=t(1),a=t(68),s=t(70),m=t(215),p=[0,0,1024,968],r=new s.a({code:"xkcd-image",units:"pixels",extent:p});new o.a({layers:[new a.a({source:new m.a({attributions:'© ***<a href="http://xkcd.com/license.html">xkcd</a>',url:"https://www.loremipsum.com/***",projection:r,imageExtent:p})})],target:"map",view:new c.a({projection:r,center:Object(i.y)(p),zoom:2,maxZoom:8})})}},[[370,0]]]);
//# sourceMappingURL=static-image.js.map

【问题讨论】:

  • 您在这里的问题非常不清楚......您不能提供缩小(和丑化)的代码并期望得到答案......请检查stackoverflow.com/help/how-to-ask 部分并返回一个清晰的代码和明确的问题

标签: javascript openlayers src


【解决方案1】:

如果关闭图像平滑,放大时可以获得更清晰的图像

在 OpenLayers 6 中:

imageLayer.on('prerender', function (event) {
  event.context.imageSmoothingEnabled = false;
  event.context.msImageSmoothingEnabled = false;
});

在版本 3 到 5 中:

imageLayer.on('precompose', function (event) {
  event.context.imageSmoothingEnabled = false;
  event.context.msImageSmoothingEnabled = false;
});

msImageSmoothingEnabled 仅在您需要支持 Internet Explorer 时才需要

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多