本文介绍了openlayers 5.1.3:“损坏"的层.快速入门示例中的缩小按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从google地图切换到osm,并尝试使用OpenLayers(快速入门示例).如果我使用托管版本,则一切正常.但是,如果我下载5.1.3软件包并将其托管在我们的Web服务器上,则缩小按钮的标题已损坏.网址: http://www.canalcup-cam.de/maps.php
看起来好像使用了非ASCII-" ...我试图找到设置按钮标题的代码,但是没有成功.网站的编码与此有关吗?我尝试了utf-8和Windows-1250.

i try to switch from google maps to osm and tried OpenLayers (the quick start example).If i use the hosted builds, everything looks ok. But if i download the 5.1.3 package and host it on our webserver, the caption of the zoom out button is damaged. URL: http://www.canalcup-cam.de/maps.php
It looks as if a non ASCII "-" is used ...I tried to find the code, where the caption of the button is set, but without success.Has the encoding of the website to do with this? I tried utf-8 and Windows-1250.

关于,

推荐答案

当我获取代码副本并链接到ol.js副本时,我需要插入<meta charset="utf-8">作为减号(这是html 而不是连字符)以正确显示:

When I take a copy of your code and link to your copy of ol.js I need to insert <meta charset="utf-8"> for the minus (it's the html &minus; not a hyphen) to show correctly:

  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.1.3/css/ol.css" type="text/css">
    <style>
      .map {
        height: 400px;
        width: 100%;
      }
    </style>
    <script src="http://www.canalcup-cam.de/inc/OpenLayers/v5.1.3/build/ol.js"></script>

    <title>OpenLayers example</title>
  </head>

但是使用ol.js的CDN版本时,无需meta标签即可使用.也许您的副本已经过某种更改,但是始终包含meta标签仍然是一种好习惯.

But using the cdn version of ol.js it works without the meta tag. Maybe your copy has been altered in some way, but it is still good practice to always include the meta tag.

  <head>
    <link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.1.3/css/ol.css" type="text/css">
    <style>
      .map {
        height: 400px;
        width: 100%;
      }
    </style>
    <script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.1.3/build/ol.js"></script>

    <title>OpenLayers example</title>
  </head>

这篇关于openlayers 5.1.3:“损坏"的层.快速入门示例中的缩小按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 00:47