# 创建地图

# param

  • 类型: object
  • 描述: 参数包括以下属性字段。
    • id 必须 string 地图容器dom的id
    • center 必须 Array 地图初始的中心位置
    • zoom 必须 number 地图初始的层级

# 在html中使用

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
</head>
<style>
    #map{
        width: 100%;
        height: 100vh;
        display: flex;
    }
    body {
        margin: 0px;
    }
</style>
<body>
</body>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://unpkg.com/xw-soonmap/dist/sdk/index.js"></script>
<link rel="stylesheet" href="https://unpkg.com/xw-soonmap/dist/sdk/style/map.css">
<!-- soonmap 是支持ie版本,部分绘制插件因兼容原因无法在ie使用 -->
<!-- <script src="https://unpkg.com/soonmap/dist/sdk/index.js"></script>
<link rel="stylesheet" href="https://unpkg.com/soonmap/dist/sdk/style/map.css"> -->
<div id="map"></div>

<script>
    var smp = new SoonMap({
        id:'map', 
        center:[116.4, 39.9], 
        zoom:9,
        hasBaseMap:true,
        //地图底图的发布地址
        url:"http://gis.map.xwbuilders.com:8888/file/beijing/pro/jiye/Tiles_BIGEMAP/{z}/{x}/{y}.png"
    });    
</script>
</html>
最后更新: 2021/2/23 11:24:39