Echarts省份地图展示

效果图:

文件中引入的咸阳json数据如下:

xianyang.json

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(['exports', 'echarts'], factory);
    } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
        // CommonJS
        factory(exports, require('echarts'));
    } else {
        // Browser globals
        factory({}, root.echarts);
    }
}(this, function (exports, echarts) {
    const log = function (msg) {
        if (typeof console !== 'undefined') {
            console && console.error && console.error(msg);
        }
    }
    if (!echarts) {
        log('ECharts is not Loaded');
        return;
    }
    if (!echarts.registerMap) {
        log('ECharts Map is not loaded')
        return;
    }
    echarts.registerMap('咸阳', 
    {
      "type": "FeatureCollection",
      "features": [
          {
              "type": "Feature",
              "properties": {
                  "name": "渭城区",
                  "id": "610404"
              },
              "geometry": {
                  "type": "MultiPolygon",
                  "coordinates": [
                      [
                          [
                              [
                                  108.840924101563,
                                  34.4777919746094
                              ],
                              [
                                  108.871898222656,
                                  34.457622296875
                              ],
                              [
                                  108.897669707031,
                                  34.4633998847656
                              ],
                              [
                                  108.921429472656,
                                  34.4479274726562
                              ],
                              [
                                  108.957345,
                                  34.4438430000001
                              ],
                              [
                                  108.957345,
                                  34.423843
                              ],
                              [
                                  108.914276152344,
                                  34.4069118476562
                              ],
                              [
                                  108.85170046875,
                                  34.3894863105469
                              ],
                              [
                                  108.83298953125,
                                  34.3781996894532
                              ],
                              [
                                  108.797345,
                                  34.3638430000001
                              ],
                              [
                                  108.716707792969,
                                  34.3317116523438
                              ],
                              [
                                  108.70298953125,
                                  34.3494863105469
                              ],
                              [
                                  108.68170046875,
                                  34.3581996894531
                              ],
                              [
                                  108.67298953125,
                                  34.3877358222656
                              ],
                              [
                                  108.706822539063,
                                  34.4333705878907
                              ],
                              [
                                  108.667345,
                                  34.463843
                              ],
                              [
                                  108.670704375,
                                  34.470483625
                              ],
                              [
                                  108.697345,
                                  34.4838430000001
                              ],
                              [
                                  108.715545683594,
                                  34.4761977363281
                              ],
                              [
                                  108.732345,
                                  34.4799636054688
                              ],
                              [
                                  108.755662871094,
                                  34.4747365546876
                              ],
                              [
                                  108.792515898438,
                                  34.4902150703125
                              ],
                              [
                                  108.840924101563,
                                  34.4777919746094
                              ]
                          ]
                      ]
                  ]
              }
          },
          {
              "type": "Feature",
              "properties": {
                  "name": "三原县",
                  "id": "610422"
              },
              "geometry": {
                  "type": "MultiPolygon",
                  "coordinates": [
                      [
                          [
                              [
                                  108.967345,
                                  34.8238430000001
                              ],
                              [
                                  108.992806425781,
                                  34.8093056464844
                              ],
                              [
                                  109.01095828125,
                                  34.7874550605469
                              ],
                              [
                                  109.035714140625,
                                  34.7668910957032
                              ],
                              [
                                  109.0292590625,
                                  34.7035756660156
                              ],
                              [
                                  109.043192167969,
                                  34.6868044257813
                              ],
                              [
                                  109.062884550781,
                                  34.7105104804688
                              ],
                              [
                                  109.162806425781,
                                  34.6993056464844
                              ],
                              [
                                  109.167345,
                                  34.693843
                              ],
                              [
                                  109.163260527344,
                                  34.6679274726563
                              ],
                              [
                                  109.147345,
                                  34.643843
                              ],
                              [
                                  109.124307890625,
                                  34.6296486640626
                              ],
                              [
                                  109.136766386719,
                                  34.5896486640626
                              ],
                              [
                                  109.127345,
                                  34.583843
                              ],
                              [
                                  109.036781035156,
                                  34.5951576972657
                              ],
                              [
                                  108.992899199219,
                                  34.5782900214844
                              ],
                              [
                                  108.947345,
                                  34.573843
                              ],
                              [
                                  108.925662871094,
                                  34.5829494453125
                              ],
                              [
                                  108.901673613281,
                                  34.5775722480469
                              ],
                              [
                                  108.881651640625,
                                  34.6065724921875
                              ],
                              [
                                  108.873260527344,
                                  34.6576625800782
                              ],
                              [
                                  108.915767851563,
                                  34.6685707832031
                              ],
                              [
                                  108.905811796875,
                                  34.7129824042969
                              ],
                              [
                                  108.859581328125,
                                  34.7026186347656
                              ],
                              [
                                  108.833260527344,
                                  34.7197585273438
                              ],
                              [
                                  108.801429472656,
                                  34.7279274726563
                              ],
                              [
                                  108.787345,
                                  34.733843
                              ],
                              [
                                  108.780704375,
                                  34.747202375
                              ],
                              [
                                  108.773985625,
                                  34.7891274238282
                              ],
                              [
                                  108.813985625,
                                  34.797202375
                              ],
                              [
                                  108.817345,
                                  34.803843
                              ],
                              [
                                  108.852064238281,
                                  34.8203273750001
                              ],
                              [
                                  108.888533964844,
                                  34.8100783515626
                              ],
                              [
                                  108.906246367188,
                                  34.8377455878907
                              ],
                              [
                                  108.953441191406,
                                  34.8299404121094
                              ],
                              [
                                  108.967345,
                                  34.8238430000001
                              ]
                          ]
                      ]
                  ]
              }
          },
          {
              "type": "Feature",
              "properties": {
                  "name": "彬县",
                  "id": "610427"
              },
              "geometry": {
                  "type": "MultiPolygon",
                  "coordinates": [
                      [
                          [
                              [
                                  108.149163847656,
                                  35.2323220039063
                              ],
                              [
                                  108.183577910156,
                                  35.2068080878907
                              ],
                              [
                                  108.202857695313,
                                  35.2096572089844
                              ],
                              [
                                  108.21170046875,
                                  35.1981996894532
                              ],
                              [
                                  108.223519316406,
                                  35.189077375
                              ],
                              [
                                  108.198707304688,
                                  35.1479457832032
                              ],
                              [
                                  108.180418730469,
                                  35.0528163886719
                              ],
                              [
                                  108.201654082031,
                                  35.0253041816406
                              ],
                              [
                                  108.255257597656,
                                  34.9855629707032
                              ],
                              [
                                  108.31298953125,
                                  34.9694863105469
                              ],
                              [
                                  108.347345,
                                  34.953843
                              ],
                              [
                                  108.343985625,
                                  34.937202375
                              ],
                              [
                                  108.320704375,
                                  34.890483625
                              ],
                              [
                                  108.317345,
                                  34.873843
                              ],
                              [
                                  108.307345,
                                  34.873843
                              ],
                              [
                                  108.307345,
                                  34.8638430000001
                              ],
                              [
                                  108.277623320313,
                                  34.8811464667969
                              ],
                              [
                                  108.25209109375,
                                  34.90972190625
                              ],
                              [
                                  108.231080351563,
                                  34.9084694648438
                              ],
                              [
                                  108.212625761719,
                                  34.9291237617188
                              ],
                              [
                                  108.202064238281,
                                  34.9385622382813
                              ],
                              [
                                  108.192625761719,
                                  34.9491237617188
                              ],
                              [
                                  108.177323027344,
                                  34.962798078125
                              ],
                              [
                                  108.120130644531,
                                  34.9228481269531
                              ],
                              [
                                  108.032064238281,
                                  34.9091237617188
                              ],
                              [
                                  108.02259890625,
                                  34.8985305000001
                              ],
                              [
                                  108.012120390625,
                                  34.8991542792969
                              ],
                              [
                                  107.947345,
                                  34.8638430000001
                              ],
                              [
                                  107.931429472656,
                                  34.8597585273438
                              ],
                              [
                                  107.917652617188,
                                  34.8398061347657
                              ],
                              [
                                  107.872345,
                                  34.8499636054688
                              ],
                              [
                                  107.850369902344,
                                  34.8450380683594
                              ],
                              [
                                  107.853529082031,
                                  34.8591213203126
                              ],
                              [
                                  107.841160917969,
                                  34.8885646796875
                              ],
                              [
                                  107.843565703125,
                                  34.8992897773438
                              ],
                              [
                                  107.831429472656,
                                  34.9179274726563
                              ],
                              [
                                  107.817345,
                                  34.9738430000001
                              ],
                              [
                                  107.817345,
                                  34.983843
                              ],
                              [
                                  107.857345,
                                  34.983843
                              ],
                              [
                                  107.857345,
                                  34.993843
                              ],
                              [
                                  107.870152617188,
                                  34.998843
                              ],
                              [
                                  107.857345,
                                  35.003843
                              ],
                              [
                                  107.886922636719,
                                  35.0468581367188
                              ],
                              [
                                  107.905159941406,
                                  35.0240846992188
                              ],
                              [
                                  107.924049101563,
                                  35.0392104316407
                              ],
                              [
                                  107.957337675781,
                                  35.0958412910157
                              ],
                              [
                                  107.931070585938,
                                  35.1168740058594
                              ],
                              [
                                  107.943155546875,
                                  35.1591896796875
                              ],
                              [
                                  107.93134890625,
                                  35.1686440253906
                              ],
                              [
                                  107.94322390625,
                                  35.188843
                              ],
                              [
                                  107.930213652344,
                                  35.2109743476563
                              ],
                              [
                                  107.971790800781,
                                  35.2058022285157
                              ],
                              [
                                  107.952899199219,
                                  35.2293959785157
                              ],
                              [
                                  107.941102324219,
                                  35.2388430000001
                              ],
                              [
                                  107.947345,
                                  35.2438430000001
                              ],
                              [
                                  108.046749296875,
                                  35.2539821601563
                              ],
                              [
                                  108.09197390625,
                                  35.2792153144531
                              ],
                              [
                                  108.127345,
                                  35.2838430000001
                              ],
                              [
                                  108.136058378906,
                                  35.2725551582031
                              ],
                              [
                                  108.153160429688,
                                  35.2593544746095
                              ],
                              [
                                  108.149163847656,
                                  35.2323220039063
                              ]
                          ]
                      ]
                  ]
              }
          },
          {
              "type": "Feature",
              "properties": {
                  "name": "长武县",
                  "id": "610428"
              },
              "geometry": {
                  "type": "MultiPolygon",
                  "coordinates": [
                      [
                          [
                              [
                                  107.857345,
                                  35.003843
                              ],
                              [
                                  107.870152617188,
                                  34.998843
                              ],
                              [
                                  107.857345,
                                  34.993843
                              ],
                              [
                                  107.857345,
                                  35.003843
                              ]
                          ]
                      ],
                      [
                          [
                              [
                                  107.713922148438,
                                  35.3060353828126
                              ],
                              [
                                  107.717345,
                                  35.293843
                              ],
                              [
                                  107.705152617188,
                                  35.2972658515625
                              ],
                              [
                                  107.713922148438,
                                  35.30
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值