首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >单张地图的问题

单张地图的问题
EN

Stack Overflow用户
提问于 2022-08-11 14:52:19
回答 1查看 72关注 0票数 0

我正在尝试实现一个传单地图API,但我不能让它出现。我正在跟踪这个链接。term=desclink-传单-样本

我的代码map.component.html

代码语言:javascript
复制
<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js"></script>
    <style>
      #map {position: absolute; top: 0; right: 0; bottom: 0; left: 0;}
    </style>
  </head>
  <body>
    <div id="map">
      <a href="https://www.maptiler.com" style="position:absolute;left:10px;bottom:10px;z-index:999;"><img src="https://api.maptiler.com/resources/logo.svg" alt="MapTiler logo"></a>
    </div>
    <p><a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a></p>
    <script>
      var map = L.map('map').setView([0, 0], 1);
      L.tileLayer('https://api.maptiler.com/maps/streets/{z}/{x}/{y}.png?key=cCaw1Q6a8s1Bm4tJPpTq',{
        tileSize: 512,
        zoomOffset: -1,
        minZoom: 1,
        attribution: "\u003ca href=\"https://www.maptiler.com/copyright/\" target=\"_blank\"\u003e\u0026copy; MapTiler\u003c/a\u003e \u003ca href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\"\u003e\u0026copy; OpenStreetMap contributors\u003c/a\u003e",
        crossOrigin: true
      }).addTo(map);
    </script>
  </body>
</html>

map.component.css

代码语言:javascript
复制
html { height:100%; }
body { position:absolute; top:0; bottom:0; right:0; left:0; }
EN

回答 1

Stack Overflow用户

发布于 2022-08-11 15:11:46

将html更改为:

代码语言:javascript
复制
<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" 
content="initial-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" 
href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css" />
    <script 
src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js"></script>
    <style>
      #map {position: absolute; top: 0; right: 0; bottom: 0; left: 0;}
    </style>
  </head>
  <body>
    <div id="map">
      <a href="https://www.maptiler.com" 
style="position:absolute;left:10px;bottom:10px;z-index:999;"><img 
src="https://api.maptiler.com/resources/logo.svg" alt="MapTiler logo"></a>
    </div>
    <p><a href="https://www.maptiler.com/copyright/" 
target="_blank">&copy; MapTiler</a> <a 
href="https://www.openstreetmap.org/copyright" target="_blank">&copy; 
OpenStreetMap contributors</a></p>
    <script>
      var map = L.map('map').setView([0, 0], 1);
      
L.tileLayer('https://api.maptiler.com/maps/streets/{z}/{x}/{y}.png?key=cCaw1Q6a8s1Bm4tJPpTq',{
        tileSize: 512,
        zoomOffset: -1,
        minZoom: 1,
        attribution: "\u003ca href=\"https://www.maptiler.com/copyright" /
        "target=\"_blank\"\u003e\u0026copy; MapTiler\u003c/a\u003e \u003ca" /
        "href=\"https://www.openstreetmap.org/copyright" /
        "target=\"_blank\"\u003e\u0026copy; OpenStreetMap" /
        "contributors\u003c/a\u003e",
        crossOrigin: true
      }).addTo(map);
    </script>
  </body>
</html>

你的titleLayer有\n个角色。

下面是一个例子

如果你想用角度来处理传单,最好的解决办法是使用有角度的传单。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73322762

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档