必威体育Betway必威体育官网
当前位置:首页 > IT技术

nuxt百度地图引入基础使用,百度地图初始化,行政区划划分

时间:2019-11-01 23:42:11来源:IT技术作者:seo实验室小编阅读:89次「手机版」
 

001064

如何在nuxt项目中使用百度地图

进入百度地图API

在这里插入图片描述

选择javascriptAPI,按照流程注册账号获取ak,复制ak

在这里插入图片描述

按照页面提示的,需要引入script标签在这里插入图片描述

这里我们打开nuxt项目中的nuxt.config.js文件,如果没有link和script,自己按照格式创建

输入上面的地址,ak后面填写自己的 ,像这样

在这里插入图片描述

然后,看你是把它当作插件还是单独的页面,在components中或者其他文件夹中创建BaiduMap.vue文件,接着就是一下代码,各个部分的功能我会在注释中解释清楚

<template>
  <p id="map">
    <el-input class="input" v-model="place" @change="init"></el-input>
    <el-button @click="init">查询</el-button>
        <!-- container容器,用来作为渲染百度地图的容器p -->
    <p id="container"></p>
    <p id="searchBox"></p>
  </p>
</template>

<script>
export default {
// 组件命名
  name: 'baidu-map',
  data() {
    return {
      place: ''
    }
  },
  created() {},
  mounted() {
  //组件初始化
    this.init()
  },
  methods: {
    init() {
      const that = this
      // 地图初始
      var map = new BMap.Map('container', {
        enableHighResolution: true
      })
      // 中心点
      var point = new BMap.Point(111.150529, 37.525934)
      map.centerAndZoom(point, 12)
      // 添加控件
      map.addControl(new BMap.navigationControl())
      map.addControl(new BMap.scaleControl())
      map.addControl(new BMap.OverviewMapControl())
      map.addControl(new BMap.MapTypeControl())
      map.enablescrollWheelZoom(true)
      map.clearoverlays() //清除地图覆盖物
      var boundaries = []
      //设置行政区域IP,我这是固定的,也可以根据百度的接口通过行政单位名称在线查找渲染
      boundaries[0] =
        '111.502869, 36.997173;111.51205, 36.983309;111.526819, 36.975695;111.531577, 36.959955;111.549879, 36.951562;111.548686, 36.93774;111.559309, 36.934797;111.562849, 36.930905;111.575121, 36.932982;111.582326, 36.926032;111.56338, 36.905968;111.552014, 36.898367;111.531404, 36.891954;111.513835, 36.894125;111.50763, 36.887778;111.498123, 36.885295;111.493662, 36.877462;111.481425, 36.872586;111.47461, 36.863084;111.466134, 36.858247;111.462444, 36.850407;111.445884, 36.841352;111.419998, 36.846709;111.416401, 36.839252;111.419848, 36.825576;111.413745, 36.806936;111.392045, 36.803895;111.388693, 36.795959;111.375529, 36.782663;111.372424, 36.773289;111.357432, 36.759113;111.330734, 36.757612;111.326764, 36.746747;111.296348, 36.743037;111.295285, 36.737736;111.280935, 36.741611;111.28469, 36.753356;111.281177, 36.76515;111.270506, 36.762673;111.250909, 36.764998;111.24266, 36.761042;111.239956, 36.750926;111.235205, 36.747412;111.219272, 36.749783;111.209055, 36.780718;111.212108, 36.79136;111.199144, 36.808381;111.1899, 36.81399;111.191591, 36.822904;111.185428, 36.852696;111.179448, 36.851956;111.174152, 36.846317;111.14193, 36.851408;111.121141, 36.842283;111.10852, 36.848115;111.087922, 36.847041;111.077787, 36.854248;111.072861, 36.860936;111.076356, 36.877087;111.086934, 36.893421;111.08629, 36.908233;111.099173, 36.921532;111.092262, 36.927144;111.085904, 36.940184;111.060781, 36.936588;111.024874, 36.911172;111.014201, 36.913793;111.009851, 36.904472;111.005282, 36.922441;110.993591, 36.925046;110.991348, 36.922975;110.9973, 36.910843;110.979154, 36.899981;110.974374, 36.904402;110.964449, 36.902495;110.957974, 36.911406;110.951846, 36.908214;110.944779, 36.908664;110.932587, 36.897756;110.910813, 36.896605;110.909034, 36.893672;110.904952, 36.894006;110.905431, 36.888382;110.893799, 36.881187;110.88704, 36.882835;110.855412, 36.864057;110.847503, 36.865393;110.843201, 36.862173;110.835878, 36.86556;110.822767, 36.863847;110.811957, 36.866463;110.806247, 36.872794;110.791186, 36.865813;110.783055, 36.87307;110.783185, 36.88229;110.777691, 36.889108;110.778742, 36.897797;110.770492, 36.901198;110.766688, 36.909144;110.751442, 36.914171;110.738389, 36.91184;110.734024, 36.913748;110.721919, 36.940004;110.711148, 36.939302;110.703375, 36.935282;110.694832, 36.939122;110.692404, 36.935153;110.682836, 36.93467;110.678358, 36.939814;110.668368, 36.940334;110.663822, 36.933729;110.651101, 36.926997;110.646935, 36.906362;110.655083, 36.899918;110.648686, 36.886532;110.641858, 36.889206;110.63974, 36.879186;110.636025, 36.877293;110.626943, 36.879996;110.612785, 36.876314;110.605592, 36.880152;110.59469, 36.870897;110.588819, 36.872469;110.578547, 36.867199;110.576995, 36.863155;110.560679, 36.873439;110.552577, 36.870451;110.545385, 36.872923;110.536913, 36.881074;110.529032, 36.876958;110.49324, 36.885127;110.490693, 36.879953;110.477038, 36.878071;110.467458, 36.892604;110.452313, 36.896369;110.438231, 36.891024;110.43101, 36.900075;110.415367, 36.90565;110.419805, 36.936678;110.430279, 36.95732;110.428974, 36.969785;110.413289, 36.994482;110.384516, 37.010342;110.381075, 37.018692;110.38322, 37.025684;110.405315, 37.029602;110.43485, 37.013411;110.445413, 37.011743;110.45295, 37.014636;110.454486, 37.024756;110.426809, 37.0297;110.421134, 37.034295;110.421889, 37.040067;110.43458, 37.047958;110.462865, 37.048891;110.503687, 37.095716;110.536429, 37.114126;110.54082, 37.120881;110.541681, 37.147524;110.587439, 37.182933;110.618708, 37.221749;110.638632, 37.238098;110.644575, 37.252432;110.658839, 37.264478;110.659938, 37.282008;110.666884, 37.288167;110.685078, 37.287244;110.693159, 37.289596;110.69554, 37.300882;110.684187, 37.313149;110.68328, 37.321618;110.703419, 37.337005;110.704454, 37.351065;110.682227, 37.359363;110.644192, 37.366968;110.634913, 37.3784;110.634826, 37.402078;110.644896, 37.419689;110.64842, 37.440312;110.658548, 37.448205;110.691094, 37.446889;110.753136, 37.457275;110.764776, 37.483406;110.761925, 37.493126;110.763858, 37.508597;110.777173, 37.528211;110.776332, 37.543195;110.792081, 37.553513;110.801355, 37.569426;110.777024, 37.599649;110.776664, 37.62483;110.768723, 37.640802;110.774337, 37.65231;110.791462, 37.652112;110.796945, 37.655341;110.802716, 37.664518;110.801998, 37.669692;110.77457, 37.691302;110.745963, 37.695193;110.719717, 37.70425;110.708071, 37.718319;110.708483, 37.725575;110.716323, 37.732877;110.758218, 37.745341;110.763756, 37.751648;110.763437, 37.75863;110.750231, 37.771353;110.733303, 37.780401;110.706813, 37.789959;110.692381, 37.791147;110.676019, 37.803213;110.668135, 37.81469;110.664624, 37.833145;110.645869, 37.859353;110.639595, 37.862915;110.601096, 37.925938;110.578589, 37.939835;110.525977, 37.960968;110.522047, 37.977596;110.533289, 38.001324;110.526276, 38.012843;110.512996, 38.01863;110.506954, 38.039127;110.514485, 38.075504;110.505777, 38.099038;110.509893, 38.108161;110.525416, 38.123235;110.527384, 38.130145;110.512004, 38.165314;110.51167, 38.19279;110.517233, 38.204212;110.527968, 38.21541;110.541341, 38.218276;110.560251, 38.21625;110.570828, 38.22099;110.579151, 38.296144;110.589727, 38.31062;110.606935, 38.31437;110.644932, 38.310805;110.664658, 38.315424;110.681799, 38.327244;110.696951, 38.349793;110.713219, 38.363243;110.722618, 38.365985;110.73681, 38.364785;110.748831, 38.370206;110.756952, 38.379723;110.757242, 38.393684;110.773894, 38.419989;110.785073, 38.450777;110.793467, 38.456811;110.821708, 38.458221;110.848492, 38.445751;110.880204, 38.461783;110.879476, 38.499783;110.875132, 38.516394;110.885625, 38.522884;110.902063, 38.52114;110.91183, 38.525984;110.916075, 38.549619;110.913041, 38.565726;110.925454, 38.583625;110.923414, 38.587654;110.900549, 38.595243;110.897906, 38.607179;110.885635, 38.619338;110.885206, 38.63164;110.900954, 38.663795;110.919778, 38.677363;110.916761, 38.692071;110.919733, 38.704411;110.950739, 38.734734;110.959458, 38.725989;110.960156, 38.719817;110.960054, 38.713861;110.953261, 38.705227;110.95523, 38.687775;110.962645, 38.685727;110.991048, 38.688062;111.005419, 38.676953;111.008431, 38.669147;111.022506, 38.660781;111.043078, 38.667965;111.047202, 38.676247;111.072309, 38.683177;111.078715, 38.692839;111.077884, 38.702396;111.091626, 38.697984;111.106007, 38.699866;111.12892, 38.719514;111.149658, 38.727229;111.164783, 38.725597;111.182989, 38.73704;111.210877, 38.733626;111.225311, 38.715759;111.221899, 38.69793;111.234845, 38.687044;111.231965, 38.672963;111.244359, 38.669828;111.264293, 38.654071;111.252819, 38.636204;111.26518, 38.62752;111.273882, 38.601177;111.285612, 38.603672;111.297469, 38.598143;111.313443, 38.603714;111.330355, 38.601716;111.351835, 38.609567;111.353197, 38.590402;111.365247, 38.58814;111.378703, 38.579253;111.428115, 38.576198;111.433986, 38.579376;111.451202, 38.572916;111.455296, 38.564001;111.457462, 38.525988;111.467749, 38.517111;111.485797, 38.513816;111.494859, 38.498881;111.506532, 38.492723;111.505298, 38.514801;111.5084, 38.528567;111.529059, 38.531358;111.550769, 38.514421;111.564681, 38.512655;111.571682, 38.517234;111.576509, 38.528148;111.594072, 38.541657;111.604424, 38.544216;111.614603, 38.551372;111.659225, 38.560315;111.662802, 38.564564;111.67477, 38.566667;111.680149, 38.573148;111.695989, 38.575376;111.698375, 38.585272;111.716035, 38.608233;111.727685, 38.605947;111.75731, 38.581863;111.762644, 38.575651;111.769781, 38.55263;111.779051, 38.541584;111.754374, 38.531907;111.72252, 38.512647;111.761534, 38.482223;111.770684, 38.480197;111.778142, 38.464883;111.794931, 38.45684;111.797397, 38.448331;111.804773, 38.440676;111.792819, 38.420916;111.794402, 38.412732;111.799029, 38.408239;111.79416, 38.393429;111.810197, 38.388669;111.828424, 38.375186;111.82676, 38.366745;111.833176, 38.355705;111.826686, 38.342871;111.829998, 38.328876;111.842636, 38.320199;111.842192, 38.308509;111.836904, 38.304937;111.811592, 38.30149;111.799391, 38.293267;111.786606, 38.297249;111.772995, 38.285596;111.778737, 38.274428;111.776688, 38.267457;111.781987, 38.259053;111.782858, 38.248001;111.80318, 38.243381;111.810599, 38.228251;111.822783, 38.220335;111.822408, 38.21773;111.815856, 38.215736;111.806139, 38.205407;111.79352, 38.20145;111.782445, 38.192225;111.778673, 38.193398;111.771614, 38.184994;111.750323, 38.18757;111.742523, 38.183504;111.722742, 38.182494;111.724083, 38.165515;111.704571, 38.158037;111.69699, 38.149235;111.69468, 38.139915;111.679369, 38.13615;111.648439, 38.121826;111.630157, 38.107889;111.5729, 38.101372;111.552865, 38.09099;111.549017, 38.077411;111.5287, 38.071376;111.532431, 38.062985;111.523833, 38.060739;111.521159, 38.056288;111.533543, 38.044297;111.523642, 38.031541;111.522857, 38.021947;111.528795, 38.010112;111.541881, 38.001064;111.550932, 37.961583;111.559628, 37.948789;111.568111, 37.942246;111.581867, 37.937294;111.579568, 37.919654;111.584474, 37.907291;111.552415, 37.890872;111.569991, 37.884515;111.572731, 37.865639;111.580162, 37.853829;111.597052, 37.862759;111.613964, 37.861893;111.623375, 37.865749;111.637349, 37.864161;111.645901, 37.867389;111.658816, 37.862291;111.671158, 37.869232;111.686793, 37.868841;111.695582, 37.880657;111.711241, 37.885151;111.724581, 37.880885;111.732188, 37.882142;111.750304, 37.87823;111.752045, 37.861484;111.773227, 37.847125;111.77401, 37.837;111.793646, 37.832812;111.813727, 37.823005;111.821264, 37.814971;111.824982, 37.802186;111.886726, 37.798135;111.903386, 37.804747;111.915056, 37.801078;111.91754, 37.798577;111.915987, 37.786169;111.923447, 37.780188;111.926624, 37.763697;111.940213, 37.746731;111.939097, 37.737316;111.958122, 37.740957;111.972631, 37.719982;111.980104, 37.719366;112.00146, 37.727922;112.0219, 37.727174;112.02864, 37.729536;112.038323, 37.717824;112.043582, 37.715859;112.065212, 37.717286;112.087213, 37.724022;112.097518, 37.719969;112.11022, 37.721792;112.122038, 37.707568;112.134022, 37.705779;112.140553, 37.696243;112.152105, 37.694712;112.155639, 37.688487;112.183688, 37.675128;112.183804, 37.668966;112.17544, 37.661414;112.180287, 37.652532;112.181344, 37.640531;112.19298, 37.633258;112.21803, 37.606067;112.227094, 37.604545;112.234839, 37.599131;112.243257, 37.567756;112.285156, 37.573351;112.301271, 37.571566;112.296721, 37.549403;112.282357, 37.53719;112.293069, 37.527041;112.305758, 37.526248;112.308075, 37.513093;112.322889, 37.510575;112.322704, 37.501203;112.299102, 37.494537;112.307928, 37.486289;112.328641, 37.476894;112.334058, 37.469232;112.333791, 37.455161;112.323062, 37.448715;112.295731, 37.443843;112.273137, 37.43241;112.251718, 37.381844;112.229741, 37.357998;112.22865, 37.347992;112.209927, 37.337713;112.201796, 37.323497;112.188074, 37.31793;112.165611, 37.294686;112.153013, 37.275806;112.145894, 37.273415;112.137502, 37.277194;112.130719, 37.283349;112.125789, 37.301183;112.103057, 37.312019;112.09671, 37.322105;112.085179, 37.324084;112.07843, 37.322205;112.067101, 37.311466;112.045056, 37.278553;112.036322, 37.278486;112.018676, 37.289814;112.003616, 37.280307;111.982567, 37.275564;111.941592, 37.257958;111.951747, 37.251343;111.958503, 37.241644;111.950037, 37.218388;111.951039, 37.178583;111.943131, 37.167153;111.922569, 37.10491;111.900341, 37.093236;111.901725, 37.081163;111.890886, 37.062947;111.867085, 37.057128;111.869651, 37.044606;111.851453, 37.040713;111.838105, 37.04983;111.830041, 37.050115;111.833419, 37.04126;111.822268, 37.028737;111.817519, 37.030068;111.808186, 37.023311;111.798188, 37.029224;111.801321, 37.028645;111.798101, 37.033448;111.79132, 37.031157;111.788596, 37.023661;111.778564, 37.018052;111.780116, 37.015888;111.77161, 37.019752;111.761603, 37.01527;111.756111, 37.017546;111.75711, 37.011514;111.749355, 37.007007;111.7461, 36.996524;111.736724, 36.996759;111.735028, 36.992406;111.733158, 36.997358;111.728369, 36.994944;111.721236, 37.00063;111.710357, 36.990207;111.689354, 36.998011;111.683797, 36.99296;111.686599, 36.981565;111.681255, 36.974413;111.677376, 36.973204;111.670108, 36.978309;111.660564, 36.968467;111.648037, 36.96889;111.64315, 36.953865;111.637838, 36.9514;111.620751, 36.957902;111.6089, 36.967698;111.594214, 36.967561;111.558615, 36.988196;111.551338, 36.982906;111.546876, 36.983539;111.537877, 36.989575;111.5362, 36.99491;111.539677, 37.002967;111.537328, 37.004209;111.502869, 36.997173'
      var pointArray = []
      //绘制行政单位轮廓
      var count = boundaries.length
      for (var i = 0; i < count; i++) {
        var ply = new BMap.Polygon(boundaries[i], {
          strokeWeight: 2,
          strokecolor: '#ff0000',
          fillColor: ''
        }) //建立多边形覆盖物
        map.addOverlay(ply) //添加覆盖物
        pointArray = pointArray.concat(ply.getPath())
      }
      map.setViewport(pointArray) //调整视野
      //实例绘图工具
      // 绘图工具插件
      var styleOptions = {
        strokeColor: 'red', //边线颜色。
        fillColor: 'red', //填充颜色。当参数为空时,圆形将没有填充效果。
        strokeWeight: 3, //边线的宽度,以像素为单位。
        strokeOpacity: 0.8, //边线透明度,取值范围0 - 1。
        fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。
        strokeStyle: 'solid' //边线的样式,solid或dashed。
      }
      if (this.getCompanylat && this.getCompanylng) {
        console.log(this.getCompanylat)
        console.log(this.getCompanylng)
        var point = new BMap.Point(this.getCompanylng, this.getCompanylat)
        var marker = new BMap.Marker(point)
        map.addOverlay(marker)
      }
      // 实例化鼠标绘制工具
      var drawingManager = new BMapLib.DrawingManager(map, {
        isOpen: open, //是否开启绘制模式
        enableDrawingTool: true, //是否显示工具栏
        drawingToolOptions: {
          anchor: BMAP_ANCHOR_BOTTOM_RIGHT, //位置
          offset: new BMap.Size(5, 5), //偏离值
          drawingModes: [BMAP_DRAWING_MARKER]
        }
      })
      drawingManager.addeventlistener('overlaycomplete', function(e) {
        const setCompanylat = e.overlay.point.lat
        const setCompanylng = e.overlay.point.lng
        var point = new BMap.Point(setCompanylat, setCompanylng)
        var arr = map.getOverlays()
        that
          .$confirm(
            '当前选择坐标为东经:' + setCompanylng + '北纬:' + setCompanylat,
            '提示',
            {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'success'
            }
          )
          .then(() => {
            that.$message({
              type: 'success',
              message: '添加成功'
            })
            map.clearOverlays()
            var boundaries = []
            boundaries[0] =
              '111.502869, 36.997173;111.51205, 36.983309;111.526819, 36.975695;111.531577, 36.959955;111.549879, 36.951562;111.548686, 36.93774;111.559309, 36.934797;111.562849, 36.930905;111.575121, 36.932982;111.582326, 36.926032;111.56338, 36.905968;111.552014, 36.898367;111.531404, 36.891954;111.513835, 36.894125;111.50763, 36.887778;111.498123, 36.885295;111.493662, 36.877462;111.481425, 36.872586;111.47461, 36.863084;111.466134, 36.858247;111.462444, 36.850407;111.445884, 36.841352;111.419998, 36.846709;111.416401, 36.839252;111.419848, 36.825576;111.413745, 36.806936;111.392045, 36.803895;111.388693, 36.795959;111.375529, 36.782663;111.372424, 36.773289;111.357432, 36.759113;111.330734, 36.757612;111.326764, 36.746747;111.296348, 36.743037;111.295285, 36.737736;111.280935, 36.741611;111.28469, 36.753356;111.281177, 36.76515;111.270506, 36.762673;111.250909, 36.764998;111.24266, 36.761042;111.239956, 36.750926;111.235205, 36.747412;111.219272, 36.749783;111.209055, 36.780718;111.212108, 36.79136;111.199144, 36.808381;111.1899, 36.81399;111.191591, 36.822904;111.185428, 36.852696;111.179448, 36.851956;111.174152, 36.846317;111.14193, 36.851408;111.121141, 36.842283;111.10852, 36.848115;111.087922, 36.847041;111.077787, 36.854248;111.072861, 36.860936;111.076356, 36.877087;111.086934, 36.893421;111.08629, 36.908233;111.099173, 36.921532;111.092262, 36.927144;111.085904, 36.940184;111.060781, 36.936588;111.024874, 36.911172;111.014201, 36.913793;111.009851, 36.904472;111.005282, 36.922441;110.993591, 36.925046;110.991348, 36.922975;110.9973, 36.910843;110.979154, 36.899981;110.974374, 36.904402;110.964449, 36.902495;110.957974, 36.911406;110.951846, 36.908214;110.944779, 36.908664;110.932587, 36.897756;110.910813, 36.896605;110.909034, 36.893672;110.904952, 36.894006;110.905431, 36.888382;110.893799, 36.881187;110.88704, 36.882835;110.855412, 36.864057;110.847503, 36.865393;110.843201, 36.862173;110.835878, 36.86556;110.822767, 36.863847;110.811957, 36.866463;110.806247, 36.872794;110.791186, 36.865813;110.783055, 36.87307;110.783185, 36.88229;110.777691, 36.889108;110.778742, 36.897797;110.770492, 36.901198;110.766688, 36.909144;110.751442, 36.914171;110.738389, 36.91184;110.734024, 36.913748;110.721919, 36.940004;110.711148, 36.939302;110.703375, 36.935282;110.694832, 36.939122;110.692404, 36.935153;110.682836, 36.93467;110.678358, 36.939814;110.668368, 36.940334;110.663822, 36.933729;110.651101, 36.926997;110.646935, 36.906362;110.655083, 36.899918;110.648686, 36.886532;110.641858, 36.889206;110.63974, 36.879186;110.636025, 36.877293;110.626943, 36.879996;110.612785, 36.876314;110.605592, 36.880152;110.59469, 36.870897;110.588819, 36.872469;110.578547, 36.867199;110.576995, 36.863155;110.560679, 36.873439;110.552577, 36.870451;110.545385, 36.872923;110.536913, 36.881074;110.529032, 36.876958;110.49324, 36.885127;110.490693, 36.879953;110.477038, 36.878071;110.467458, 36.892604;110.452313, 36.896369;110.438231, 36.891024;110.43101, 36.900075;110.415367, 36.90565;110.419805, 36.936678;110.430279, 36.95732;110.428974, 36.969785;110.413289, 36.994482;110.384516, 37.010342;110.381075, 37.018692;110.38322, 37.025684;110.405315, 37.029602;110.43485, 37.013411;110.445413, 37.011743;110.45295, 37.014636;110.454486, 37.024756;110.426809, 37.0297;110.421134, 37.034295;110.421889, 37.040067;110.43458, 37.047958;110.462865, 37.048891;110.503687, 37.095716;110.536429, 37.114126;110.54082, 37.120881;110.541681, 37.147524;110.587439, 37.182933;110.618708, 37.221749;110.638632, 37.238098;110.644575, 37.252432;110.658839, 37.264478;110.659938, 37.282008;110.666884, 37.288167;110.685078, 37.287244;110.693159, 37.289596;110.69554, 37.300882;110.684187, 37.313149;110.68328, 37.321618;110.703419, 37.337005;110.704454, 37.351065;110.682227, 37.359363;110.644192, 37.366968;110.634913, 37.3784;110.634826, 37.402078;110.644896, 37.419689;110.64842, 37.440312;110.658548, 37.448205;110.691094, 37.446889;110.753136, 37.457275;110.764776, 37.483406;110.761925, 37.493126;110.763858, 37.508597;110.777173, 37.528211;110.776332, 37.543195;110.792081, 37.553513;110.801355, 37.569426;110.777024, 37.599649;110.776664, 37.62483;110.768723, 37.640802;110.774337, 37.65231;110.791462, 37.652112;110.796945, 37.655341;110.802716, 37.664518;110.801998, 37.669692;110.77457, 37.691302;110.745963, 37.695193;110.719717, 37.70425;110.708071, 37.718319;110.708483, 37.725575;110.716323, 37.732877;110.758218, 37.745341;110.763756, 37.751648;110.763437, 37.75863;110.750231, 37.771353;110.733303, 37.780401;110.706813, 37.789959;110.692381, 37.791147;110.676019, 37.803213;110.668135, 37.81469;110.664624, 37.833145;110.645869, 37.859353;110.639595, 37.862915;110.601096, 37.925938;110.578589, 37.939835;110.525977, 37.960968;110.522047, 37.977596;110.533289, 38.001324;110.526276, 38.012843;110.512996, 38.01863;110.506954, 38.039127;110.514485, 38.075504;110.505777, 38.099038;110.509893, 38.108161;110.525416, 38.123235;110.527384, 38.130145;110.512004, 38.165314;110.51167, 38.19279;110.517233, 38.204212;110.527968, 38.21541;110.541341, 38.218276;110.560251, 38.21625;110.570828, 38.22099;110.579151, 38.296144;110.589727, 38.31062;110.606935, 38.31437;110.644932, 38.310805;110.664658, 38.315424;110.681799, 38.327244;110.696951, 38.349793;110.713219, 38.363243;110.722618, 38.365985;110.73681, 38.364785;110.748831, 38.370206;110.756952, 38.379723;110.757242, 38.393684;110.773894, 38.419989;110.785073, 38.450777;110.793467, 38.456811;110.821708, 38.458221;110.848492, 38.445751;110.880204, 38.461783;110.879476, 38.499783;110.875132, 38.516394;110.885625, 38.522884;110.902063, 38.52114;110.91183, 38.525984;110.916075, 38.549619;110.913041, 38.565726;110.925454, 38.583625;110.923414, 38.587654;110.900549, 38.595243;110.897906, 38.607179;110.885635, 38.619338;110.885206, 38.63164;110.900954, 38.663795;110.919778, 38.677363;110.916761, 38.692071;110.919733, 38.704411;110.950739, 38.734734;110.959458, 38.725989;110.960156, 38.719817;110.960054, 38.713861;110.953261, 38.705227;110.95523, 38.687775;110.962645, 38.685727;110.991048, 38.688062;111.005419, 38.676953;111.008431, 38.669147;111.022506, 38.660781;111.043078, 38.667965;111.047202, 38.676247;111.072309, 38.683177;111.078715, 38.692839;111.077884, 38.702396;111.091626, 38.697984;111.106007, 38.699866;111.12892, 38.719514;111.149658, 38.727229;111.164783, 38.725597;111.182989, 38.73704;111.210877, 38.733626;111.225311, 38.715759;111.221899, 38.69793;111.234845, 38.687044;111.231965, 38.672963;111.244359, 38.669828;111.264293, 38.654071;111.252819, 38.636204;111.26518, 38.62752;111.273882, 38.601177;111.285612, 38.603672;111.297469, 38.598143;111.313443, 38.603714;111.330355, 38.601716;111.351835, 38.609567;111.353197, 38.590402;111.365247, 38.58814;111.378703, 38.579253;111.428115, 38.576198;111.433986, 38.579376;111.451202, 38.572916;111.455296, 38.564001;111.457462, 38.525988;111.467749, 38.517111;111.485797, 38.513816;111.494859, 38.498881;111.506532, 38.492723;111.505298, 38.514801;111.5084, 38.528567;111.529059, 38.531358;111.550769, 38.514421;111.564681, 38.512655;111.571682, 38.517234;111.576509, 38.528148;111.594072, 38.541657;111.604424, 38.544216;111.614603, 38.551372;111.659225, 38.560315;111.662802, 38.564564;111.67477, 38.566667;111.680149, 38.573148;111.695989, 38.575376;111.698375, 38.585272;111.716035, 38.608233;111.727685, 38.605947;111.75731, 38.581863;111.762644, 38.575651;111.769781, 38.55263;111.779051, 38.541584;111.754374, 38.531907;111.72252, 38.512647;111.761534, 38.482223;111.770684, 38.480197;111.778142, 38.464883;111.794931, 38.45684;111.797397, 38.448331;111.804773, 38.440676;111.792819, 38.420916;111.794402, 38.412732;111.799029, 38.408239;111.79416, 38.393429;111.810197, 38.388669;111.828424, 38.375186;111.82676, 38.366745;111.833176, 38.355705;111.826686, 38.342871;111.829998, 38.328876;111.842636, 38.320199;111.842192, 38.308509;111.836904, 38.304937;111.811592, 38.30149;111.799391, 38.293267;111.786606, 38.297249;111.772995, 38.285596;111.778737, 38.274428;111.776688, 38.267457;111.781987, 38.259053;111.782858, 38.248001;111.80318, 38.243381;111.810599, 38.228251;111.822783, 38.220335;111.822408, 38.21773;111.815856, 38.215736;111.806139, 38.205407;111.79352, 38.20145;111.782445, 38.192225;111.778673, 38.193398;111.771614, 38.184994;111.750323, 38.18757;111.742523, 38.183504;111.722742, 38.182494;111.724083, 38.165515;111.704571, 38.158037;111.69699, 38.149235;111.69468, 38.139915;111.679369, 38.13615;111.648439, 38.121826;111.630157, 38.107889;111.5729, 38.101372;111.552865, 38.09099;111.549017, 38.077411;111.5287, 38.071376;111.532431, 38.062985;111.523833, 38.060739;111.521159, 38.056288;111.533543, 38.044297;111.523642, 38.031541;111.522857, 38.021947;111.528795, 38.010112;111.541881, 38.001064;111.550932, 37.961583;111.559628, 37.948789;111.568111, 37.942246;111.581867, 37.937294;111.579568, 37.919654;111.584474, 37.907291;111.552415, 37.890872;111.569991, 37.884515;111.572731, 37.865639;111.580162, 37.853829;111.597052, 37.862759;111.613964, 37.861893;111.623375, 37.865749;111.637349, 37.864161;111.645901, 37.867389;111.658816, 37.862291;111.671158, 37.869232;111.686793, 37.868841;111.695582, 37.880657;111.711241, 37.885151;111.724581, 37.880885;111.732188, 37.882142;111.750304, 37.87823;111.752045, 37.861484;111.773227, 37.847125;111.77401, 37.837;111.793646, 37.832812;111.813727, 37.823005;111.821264, 37.814971;111.824982, 37.802186;111.886726, 37.798135;111.903386, 37.804747;111.915056, 37.801078;111.91754, 37.798577;111.915987, 37.786169;111.923447, 37.780188;111.926624, 37.763697;111.940213, 37.746731;111.939097, 37.737316;111.958122, 37.740957;111.972631, 37.719982;111.980104, 37.719366;112.00146, 37.727922;112.0219, 37.727174;112.02864, 37.729536;112.038323, 37.717824;112.043582, 37.715859;112.065212, 37.717286;112.087213, 37.724022;112.097518, 37.719969;112.11022, 37.721792;112.122038, 37.707568;112.134022, 37.705779;112.140553, 37.696243;112.152105, 37.694712;112.155639, 37.688487;112.183688, 37.675128;112.183804, 37.668966;112.17544, 37.661414;112.180287, 37.652532;112.181344, 37.640531;112.19298, 37.633258;112.21803, 37.606067;112.227094, 37.604545;112.234839, 37.599131;112.243257, 37.567756;112.285156, 37.573351;112.301271, 37.571566;112.296721, 37.549403;112.282357, 37.53719;112.293069, 37.527041;112.305758, 37.526248;112.308075, 37.513093;112.322889, 37.510575;112.322704, 37.501203;112.299102, 37.494537;112.307928, 37.486289;112.328641, 37.476894;112.334058, 37.469232;112.333791, 37.455161;112.323062, 37.448715;112.295731, 37.443843;112.273137, 37.43241;112.251718, 37.381844;112.229741, 37.357998;112.22865, 37.347992;112.209927, 37.337713;112.201796, 37.323497;112.188074, 37.31793;112.165611, 37.294686;112.153013, 37.275806;112.145894, 37.273415;112.137502, 37.277194;112.130719, 37.283349;112.125789, 37.301183;112.103057, 37.312019;112.09671, 37.322105;112.085179, 37.324084;112.07843, 37.322205;112.067101, 37.311466;112.045056, 37.278553;112.036322, 37.278486;112.018676, 37.289814;112.003616, 37.280307;111.982567, 37.275564;111.941592, 37.257958;111.951747, 37.251343;111.958503, 37.241644;111.950037, 37.218388;111.951039, 37.178583;111.943131, 37.167153;111.922569, 37.10491;111.900341, 37.093236;111.901725, 37.081163;111.890886, 37.062947;111.867085, 37.057128;111.869651, 37.044606;111.851453, 37.040713;111.838105, 37.04983;111.830041, 37.050115;111.833419, 37.04126;111.822268, 37.028737;111.817519, 37.030068;111.808186, 37.023311;111.798188, 37.029224;111.801321, 37.028645;111.798101, 37.033448;111.79132, 37.031157;111.788596, 37.023661;111.778564, 37.018052;111.780116, 37.015888;111.77161, 37.019752;111.761603, 37.01527;111.756111, 37.017546;111.75711, 37.011514;111.749355, 37.007007;111.7461, 36.996524;111.736724, 36.996759;111.735028, 36.992406;111.733158, 36.997358;111.728369, 36.994944;111.721236, 37.00063;111.710357, 36.990207;111.689354, 36.998011;111.683797, 36.99296;111.686599, 36.981565;111.681255, 36.974413;111.677376, 36.973204;111.670108, 36.978309;111.660564, 36.968467;111.648037, 36.96889;111.64315, 36.953865;111.637838, 36.9514;111.620751, 36.957902;111.6089, 36.967698;111.594214, 36.967561;111.558615, 36.988196;111.551338, 36.982906;111.546876, 36.983539;111.537877, 36.989575;111.5362, 36.99491;111.539677, 37.002967;111.537328, 37.004209;111.502869, 36.997173'
            var pointArray = []
            var count = boundaries.length
            for (var i = 0; i < count; i++) {
              var ply = new BMap.Polygon(boundaries[i], {
                strokeWeight: 2,
                strokeColor: '#ff0000',
                fillColor: ''
              }) //建立多边形覆盖物
              map.addOverlay(ply) //添加覆盖物
              pointArray = pointArray.concat(ply.getPath())
            }
            map.setViewport(pointArray) //调整视野
            var time = settimeout(() => {
              that.$emit('getCompanylat', setCompanylat, setCompanylng)
              window.clearTimeout(time)
            }, 900)
            // 向父组件传递坐标
          })
          .catch(() => {
            that.$message({
              type: 'info',
              message: '已取消'
            })
            map.clearOverlays()
            var boundaries = []
            boundaries[0] =
              '111.502869, 36.997173;111.51205, 36.983309;111.526819, 36.975695;111.531577, 36.959955;111.549879, 36.951562;111.548686, 36.93774;111.559309, 36.934797;111.562849, 36.930905;111.575121, 36.932982;111.582326, 36.926032;111.56338, 36.905968;111.552014, 36.898367;111.531404, 36.891954;111.513835, 36.894125;111.50763, 36.887778;111.498123, 36.885295;111.493662, 36.877462;111.481425, 36.872586;111.47461, 36.863084;111.466134, 36.858247;111.462444, 36.850407;111.445884, 36.841352;111.419998, 36.846709;111.416401, 36.839252;111.419848, 36.825576;111.413745, 36.806936;111.392045, 36.803895;111.388693, 36.795959;111.375529, 36.782663;111.372424, 36.773289;111.357432, 36.759113;111.330734, 36.757612;111.326764, 36.746747;111.296348, 36.743037;111.295285, 36.737736;111.280935, 36.741611;111.28469, 36.753356;111.281177, 36.76515;111.270506, 36.762673;111.250909, 36.764998;111.24266, 36.761042;111.239956, 36.750926;111.235205, 36.747412;111.219272, 36.749783;111.209055, 36.780718;111.212108, 36.79136;111.199144, 36.808381;111.1899, 36.81399;111.191591, 36.822904;111.185428, 36.852696;111.179448, 36.851956;111.174152, 36.846317;111.14193, 36.851408;111.121141, 36.842283;111.10852, 36.848115;111.087922, 36.847041;111.077787, 36.854248;111.072861, 36.860936;111.076356, 36.877087;111.086934, 36.893421;111.08629, 36.908233;111.099173, 36.921532;111.092262, 36.927144;111.085904, 36.940184;111.060781, 36.936588;111.024874, 36.911172;111.014201, 36.913793;111.009851, 36.904472;111.005282, 36.922441;110.993591, 36.925046;110.991348, 36.922975;110.9973, 36.910843;110.979154, 36.899981;110.974374, 36.904402;110.964449, 36.902495;110.957974, 36.911406;110.951846, 36.908214;110.944779, 36.908664;110.932587, 36.897756;110.910813, 36.896605;110.909034, 36.893672;110.904952, 36.894006;110.905431, 36.888382;110.893799, 36.881187;110.88704, 36.882835;110.855412, 36.864057;110.847503, 36.865393;110.843201, 36.862173;110.835878, 36.86556;110.822767, 36.863847;110.811957, 36.866463;110.806247, 36.872794;110.791186, 36.865813;110.783055, 36.87307;110.783185, 36.88229;110.777691, 36.889108;110.778742, 36.897797;110.770492, 36.901198;110.766688, 36.909144;110.751442, 36.914171;110.738389, 36.91184;110.734024, 36.913748;110.721919, 36.940004;110.711148, 36.939302;110.703375, 36.935282;110.694832, 36.939122;110.692404, 36.935153;110.682836, 36.93467;110.678358, 36.939814;110.668368, 36.940334;110.663822, 36.933729;110.651101, 36.926997;110.646935, 36.906362;110.655083, 36.899918;110.648686, 36.886532;110.641858, 36.889206;110.63974, 36.879186;110.636025, 36.877293;110.626943, 36.879996;110.612785, 36.876314;110.605592, 36.880152;110.59469, 36.870897;110.588819, 36.872469;110.578547, 36.867199;110.576995, 36.863155;110.560679, 36.873439;110.552577, 36.870451;110.545385, 36.872923;110.536913, 36.881074;110.529032, 36.876958;110.49324, 36.885127;110.490693, 36.879953;110.477038, 36.878071;110.467458, 36.892604;110.452313, 36.896369;110.438231, 36.891024;110.43101, 36.900075;110.415367, 36.90565;110.419805, 36.936678;110.430279, 36.95732;110.428974, 36.969785;110.413289, 36.994482;110.384516, 37.010342;110.381075, 37.018692;110.38322, 37.025684;110.405315, 37.029602;110.43485, 37.013411;110.445413, 37.011743;110.45295, 37.014636;110.454486, 37.024756;110.426809, 37.0297;110.421134, 37.034295;110.421889, 37.040067;110.43458, 37.047958;110.462865, 37.048891;110.503687, 37.095716;110.536429, 37.114126;110.54082, 37.120881;110.541681, 37.147524;110.587439, 37.182933;110.618708, 37.221749;110.638632, 37.238098;110.644575, 37.252432;110.658839, 37.264478;110.659938, 37.282008;110.666884, 37.288167;110.685078, 37.287244;110.693159, 37.289596;110.69554, 37.300882;110.684187, 37.313149;110.68328, 37.321618;110.703419, 37.337005;110.704454, 37.351065;110.682227, 37.359363;110.644192, 37.366968;110.634913, 37.3784;110.634826, 37.402078;110.644896, 37.419689;110.64842, 37.440312;110.658548, 37.448205;110.691094, 37.446889;110.753136, 37.457275;110.764776, 37.483406;110.761925, 37.493126;110.763858, 37.508597;110.777173, 37.528211;110.776332, 37.543195;110.792081, 37.553513;110.801355, 37.569426;110.777024, 37.599649;110.776664, 37.62483;110.768723, 37.640802;110.774337, 37.65231;110.791462, 37.652112;110.796945, 37.655341;110.802716, 37.664518;110.801998, 37.669692;110.77457, 37.691302;110.745963, 37.695193;110.719717, 37.70425;110.708071, 37.718319;110.708483, 37.725575;110.716323, 37.732877;110.758218, 37.745341;110.763756, 37.751648;110.763437, 37.75863;110.750231, 37.771353;110.733303, 37.780401;110.706813, 37.789959;110.692381, 37.791147;110.676019, 37.803213;110.668135, 37.81469;110.664624, 37.833145;110.645869, 37.859353;110.639595, 37.862915;110.601096, 37.925938;110.578589, 37.939835;110.525977, 37.960968;110.522047, 37.977596;110.533289, 38.001324;110.526276, 38.012843;110.512996, 38.01863;110.506954, 38.039127;110.514485, 38.075504;110.505777, 38.099038;110.509893, 38.108161;110.525416, 38.123235;110.527384, 38.130145;110.512004, 38.165314;110.51167, 38.19279;110.517233, 38.204212;110.527968, 38.21541;110.541341, 38.218276;110.560251, 38.21625;110.570828, 38.22099;110.579151, 38.296144;110.589727, 38.31062;110.606935, 38.31437;110.644932, 38.310805;110.664658, 38.315424;110.681799, 38.327244;110.696951, 38.349793;110.713219, 38.363243;110.722618, 38.365985;110.73681, 38.364785;110.748831, 38.370206;110.756952, 38.379723;110.757242, 38.393684;110.773894, 38.419989;110.785073, 38.450777;110.793467, 38.456811;110.821708, 38.458221;110.848492, 38.445751;110.880204, 38.461783;110.879476, 38.499783;110.875132, 38.516394;110.885625, 38.522884;110.902063, 38.52114;110.91183, 38.525984;110.916075, 38.549619;110.913041, 38.565726;110.925454, 38.583625;110.923414, 38.587654;110.900549, 38.595243;110.897906, 38.607179;110.885635, 38.619338;110.885206, 38.63164;110.900954, 38.663795;110.919778, 38.677363;110.916761, 38.692071;110.919733, 38.704411;110.950739, 38.734734;110.959458, 38.725989;110.960156, 38.719817;110.960054, 38.713861;110.953261, 38.705227;110.95523, 38.687775;110.962645, 38.685727;110.991048, 38.688062;111.005419, 38.676953;111.008431, 38.669147;111.022506, 38.660781;111.043078, 38.667965;111.047202, 38.676247;111.072309, 38.683177;111.078715, 38.692839;111.077884, 38.702396;111.091626, 38.697984;111.106007, 38.699866;111.12892, 38.719514;111.149658, 38.727229;111.164783, 38.725597;111.182989, 38.73704;111.210877, 38.733626;111.225311, 38.715759;111.221899, 38.69793;111.234845, 38.687044;111.231965, 38.672963;111.244359, 38.669828;111.264293, 38.654071;111.252819, 38.636204;111.26518, 38.62752;111.273882, 38.601177;111.285612, 38.603672;111.297469, 38.598143;111.313443, 38.603714;111.330355, 38.601716;111.351835, 38.609567;111.353197, 38.590402;111.365247, 38.58814;111.378703, 38.579253;111.428115, 38.576198;111.433986, 38.579376;111.451202, 38.572916;111.455296, 38.564001;111.457462, 38.525988;111.467749, 38.517111;111.485797, 38.513816;111.494859, 38.498881;111.506532, 38.492723;111.505298, 38.514801;111.5084, 38.528567;111.529059, 38.531358;111.550769, 38.514421;111.564681, 38.512655;111.571682, 38.517234;111.576509, 38.528148;111.594072, 38.541657;111.604424, 38.544216;111.614603, 38.551372;111.659225, 38.560315;111.662802, 38.564564;111.67477, 38.566667;111.680149, 38.573148;111.695989, 38.575376;111.698375, 38.585272;111.716035, 38.608233;111.727685, 38.605947;111.75731, 38.581863;111.762644, 38.575651;111.769781, 38.55263;111.779051, 38.541584;111.754374, 38.531907;111.72252, 38.512647;111.761534, 38.482223;111.770684, 38.480197;111.778142, 38.464883;111.794931, 38.45684;111.797397, 38.448331;111.804773, 38.440676;111.792819, 38.420916;111.794402, 38.412732;111.799029, 38.408239;111.79416, 38.393429;111.810197, 38.388669;111.828424, 38.375186;111.82676, 38.366745;111.833176, 38.355705;111.826686, 38.342871;111.829998, 38.328876;111.842636, 38.320199;111.842192, 38.308509;111.836904, 38.304937;111.811592, 38.30149;111.799391, 38.293267;111.786606, 38.297249;111.772995, 38.285596;111.778737, 38.274428;111.776688, 38.267457;111.781987, 38.259053;111.782858, 38.248001;111.80318, 38.243381;111.810599, 38.228251;111.822783, 38.220335;111.822408, 38.21773;111.815856, 38.215736;111.806139, 38.205407;111.79352, 38.20145;111.782445, 38.192225;111.778673, 38.193398;111.771614, 38.184994;111.750323, 38.18757;111.742523, 38.183504;111.722742, 38.182494;111.724083, 38.165515;111.704571, 38.158037;111.69699, 38.149235;111.69468, 38.139915;111.679369, 38.13615;111.648439, 38.121826;111.630157, 38.107889;111.5729, 38.101372;111.552865, 38.09099;111.549017, 38.077411;111.5287, 38.071376;111.532431, 38.062985;111.523833, 38.060739;111.521159, 38.056288;111.533543, 38.044297;111.523642, 38.031541;111.522857, 38.021947;111.528795, 38.010112;111.541881, 38.001064;111.550932, 37.961583;111.559628, 37.948789;111.568111, 37.942246;111.581867, 37.937294;111.579568, 37.919654;111.584474, 37.907291;111.552415, 37.890872;111.569991, 37.884515;111.572731, 37.865639;111.580162, 37.853829;111.597052, 37.862759;111.613964, 37.861893;111.623375, 37.865749;111.637349, 37.864161;111.645901, 37.867389;111.658816, 37.862291;111.671158, 37.869232;111.686793, 37.868841;111.695582, 37.880657;111.711241, 37.885151;111.724581, 37.880885;111.732188, 37.882142;111.750304, 37.87823;111.752045, 37.861484;111.773227, 37.847125;111.77401, 37.837;111.793646, 37.832812;111.813727, 37.823005;111.821264, 37.814971;111.824982, 37.802186;111.886726, 37.798135;111.903386, 37.804747;111.915056, 37.801078;111.91754, 37.798577;111.915987, 37.786169;111.923447, 37.780188;111.926624, 37.763697;111.940213, 37.746731;111.939097, 37.737316;111.958122, 37.740957;111.972631, 37.719982;111.980104, 37.719366;112.00146, 37.727922;112.0219, 37.727174;112.02864, 37.729536;112.038323, 37.717824;112.043582, 37.715859;112.065212, 37.717286;112.087213, 37.724022;112.097518, 37.719969;112.11022, 37.721792;112.122038, 37.707568;112.134022, 37.705779;112.140553, 37.696243;112.152105, 37.694712;112.155639, 37.688487;112.183688, 37.675128;112.183804, 37.668966;112.17544, 37.661414;112.180287, 37.652532;112.181344, 37.640531;112.19298, 37.633258;112.21803, 37.606067;112.227094, 37.604545;112.234839, 37.599131;112.243257, 37.567756;112.285156, 37.573351;112.301271, 37.571566;112.296721, 37.549403;112.282357, 37.53719;112.293069, 37.527041;112.305758, 37.526248;112.308075, 37.513093;112.322889, 37.510575;112.322704, 37.501203;112.299102, 37.494537;112.307928, 37.486289;112.328641, 37.476894;112.334058, 37.469232;112.333791, 37.455161;112.323062, 37.448715;112.295731, 37.443843;112.273137, 37.43241;112.251718, 37.381844;112.229741, 37.357998;112.22865, 37.347992;112.209927, 37.337713;112.201796, 37.323497;112.188074, 37.31793;112.165611, 37.294686;112.153013, 37.275806;112.145894, 37.273415;112.137502, 37.277194;112.130719, 37.283349;112.125789, 37.301183;112.103057, 37.312019;112.09671, 37.322105;112.085179, 37.324084;112.07843, 37.322205;112.067101, 37.311466;112.045056, 37.278553;112.036322, 37.278486;112.018676, 37.289814;112.003616, 37.280307;111.982567, 37.275564;111.941592, 37.257958;111.951747, 37.251343;111.958503, 37.241644;111.950037, 37.218388;111.951039, 37.178583;111.943131, 37.167153;111.922569, 37.10491;111.900341, 37.093236;111.901725, 37.081163;111.890886, 37.062947;111.867085, 37.057128;111.869651, 37.044606;111.851453, 37.040713;111.838105, 37.04983;111.830041, 37.050115;111.833419, 37.04126;111.822268, 37.028737;111.817519, 37.030068;111.808186, 37.023311;111.798188, 37.029224;111.801321, 37.028645;111.798101, 37.033448;111.79132, 37.031157;111.788596, 37.023661;111.778564, 37.018052;111.780116, 37.015888;111.77161, 37.019752;111.761603, 37.01527;111.756111, 37.017546;111.75711, 37.011514;111.749355, 37.007007;111.7461, 36.996524;111.736724, 36.996759;111.735028, 36.992406;111.733158, 36.997358;111.728369, 36.994944;111.721236, 37.00063;111.710357, 36.990207;111.689354, 36.998011;111.683797, 36.99296;111.686599, 36.981565;111.681255, 36.974413;111.677376, 36.973204;111.670108, 36.978309;111.660564, 36.968467;111.648037, 36.96889;111.64315, 36.953865;111.637838, 36.9514;111.620751, 36.957902;111.6089, 36.967698;111.594214, 36.967561;111.558615, 36.988196;111.551338, 36.982906;111.546876, 36.983539;111.537877, 36.989575;111.5362, 36.99491;111.539677, 37.002967;111.537328, 37.004209;111.502869, 36.997173'
            var pointArray = []
            var count = boundaries.length
            for (var i = 0; i < count; i++) {
              var ply = new BMap.Polygon(boundaries[i], {
                strokeWeight: 2,
                strokeColor: '#ff0000',
                fillColor: ''
              }) //建立多边形覆盖物
              map.addOverlay(ply) //添加覆盖物
              pointArray = pointArray.concat(ply.getPath())
            }
            map.setViewport(pointArray) //调整视野
          })
      })
      var local = new BMap.LocalSearch(map, {
        renderOptions: { map: map }
      })
      local.search(this.place)
      /* 功能-----地图批量标点
       * 参数-----
       * 返回值-----
       * 是否完成-----
       * 是否异步函数-----
       */
      // var Bm = BMapLib.MarkerManager(map)
      // const markers = [{}]
      // BM.addMarkers(markers, minZoom, maxZoom)
    }
  }
}
</script>

<style lang="css" scoped>
// 样式
#map html {
  height: 100%;
}
#map body {
  height: 100%;
  margin: 0px;
  padding: 0px;
}
#map #container {
  height: 100%;
}
#map {
  width: 100%;
  height: 580px;
}
#map .container {
  width: 800px;
  height: 800px;
}
#map .input {
  width: 400px;
}
</style>

文章不间断更新,会把各种问题写上。

文章最后发布于: 2019-09-21 15:44:25

相关阅读

使用padding-bottom和margin-bottom实现两栏等高布局

声明:以下均为个人见解,若有错误请指出。效果预览:<!DOCTYPE html> <html> <head> <title>demo</title> <style type="tex

武汉地图

老虎地图怎么下载离线地图包?

老虎地图城市地图怎么下载?老虎地图是一款免费GPS手机地图软件,支持GPS、手机信号基站和Wifi三重定位方式,帮助用户进行生活信息搜索

京东白条优惠券兑换码怎么获取和使用呢?

京东白条优惠券兑换码怎么使用以及注意事项有哪些?京东优惠券形式多种多样,那么京东白条优惠券兑换码指的是什么又是怎么使用的呢?

Log4j的作用和使用步骤

作用:Apache的开源项目log4j是一个功能强大的日志组件,提供方便的日志记录 why:只要集成了Log4j,就可以在方法或者配置文件中加入打

分享到:

栏目导航

推荐阅读

热门阅读