Skip to content

Quick Start

First Map Example

1. HTML Page Preparation

Write the basic structure code for the HTML page, requiring a <div> node as the map container, and specify an id attribute for this <div>. In this tutorial, we use <div id="map"></div>, you can customize the id. Also introduce the SDK and CSS style files in the head

html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1.0, user-scalable=no, width=device-width"
    />
    <link
      href="https://aips.siniswift.com/sdk/sdk.style.css"
      rel="stylesheet"
    />
    <script src="https://aips.siniswift.com/sdk/nav-sdk.min.js"></script>
    <title>Nav Map</title>
    <style>
      html,
      body,
      #map {
        width: 100%;
        height: 100%;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
  </body>
</html>

2. Map Initialization

Write the basic structure code for the HTML page, requiring a <div> node as the map container, and specify an id attribute for this <div>. In this tutorial, we use <div id="map"></div>, you can customize the id. Also introduce the SDK and CSS style files in the head

html
<script>
  let sdk = new navMap.MapSDK({
    container: "map",
    center: [116.39, 39.9],
    zoom: 3,
    maxZoom: 16.5,
  });
</script>