简体   繁体   English

Angular-2 Mapzen集成

[英]Angular-2 Mapzen Integration

How do I go about integrating Mapzen in an Angular-2 application. 如何将Mapzen集成到Angular-2应用程序中。

Their tutorial has the following code. 他们的教程包含以下代码。 How would I implement this in an Angular application? 我将如何在Angular应用程序中实现呢?

  <head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="stylesheet" href="https://mapzen.com/js/mapzen.css">
    <script src="https://mapzen.com/js/mapzen.min.js"></script>

    <style>
      #map {
        height: 100%;
        width: 100%;
        position: absolute;
      }
    html,body{margin: 0; padding: 0}
  </style>

  </head>
  <body>
    <div id='map'></div>
    <script>
      var map = L.Mapzen.map('map', {
        center: [47.61033,-122.31801],
        zoom: 16,
        scene: L.Mapzen.BasemapStyles.BubbleWrap
      });
    </script>
  </body>

This code is a sample from Mapzen's JavaScript SDK, known as mapzen.js , which simplifies the process of using Mapzen's maps with the Leaflet JavaScript mapping library. 这个代码是从Mapzen的JavaScript SDK,被称为一个样本mapzen.js ,这简化了使用Mapzen的地图与单张的JavaScript库映射的过程。

This means that you will first need to get Leaflet working with Angular. 这意味着您首先需要使Leaflet与Angular一起使用。 I have not tried it, but a library like this might be a place to start: https://github.com/tombatossals/angular-leaflet-directive 我没有尝试过,但是像这样的库可能是一个开始的地方: https : //github.com/tombatossals/angular-leaflet-directive

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM