Angular-2 Mapzen Integration

585 views Asked by At

How do I go about integrating Mapzen in an Angular-2 application.

Their tutorial has the following code. How would I implement this in an Angular application?

  <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>
1

There are 1 answers

0
rhonda On

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.

This means that you will first need to get Leaflet working with Angular. I have not tried it, but a library like this might be a place to start: https://github.com/tombatossals/angular-leaflet-directive