下载 市地图
市地图
市地图
市地图
不是省地图!!!
没有地图的就到我的资源管理里面免费下载
所需要的的资料文件在我资源管理里面有欢迎下载使用
这个是能直接运行出地图的界面偶
先打开群里文件,到然后把js文件和json文件放到
这里面
准备工作: 1:需要你去网站上下载一个地图,下面放上连接:
传送门
然后打开地图
1:打开地图:
2:选择要找地区的这里以新疆某地区为例
3:找地区对应的json文件
假如我们需要找喀什地区地区该的地图我们要去百度的某网站下载json文件
网址
找到省
找到市:
4:找到该区域:并下载对应的json文件
5:打开我们项目的地图
可以看到我们项目中该地区的全名叫做喀什地区,所以我们在取js文件名的时候要叫做喀什地区
注意文件名一定要和我们地图上的名字一样
例如这个喀什地区对应的js文件名应该叫做喀什地区.json
6:新建一个js文件
由于这里设置了地址的位置
7:将下面代码复制到新建的js文件中
/*
* 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) {
var 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('城市名字', "填入json里面的内容");
}));
8:将城市名字改成我们项目地图上的名字(这里!!! 不 加!!任何后缀)
9:打开json文件
10 将json里面的内容全部复制到"填入json里面的内容"
这里面,
注意
一定要把" "引号删掉, 引号删掉引号删掉!!!
这里的引号是""
填入json里面的内容旁边的引号
我用的vscode安装的JSON Tools插件使用Ctrl+Alt+M会直接识别并转码让json文件正常显示
11修改文件名
registerMap(‘喀什地区’, 这里填入的名字
这里我就应该修改为
喀什地区.js
注意这里三处的名字一定一定要一样,不然就找不到不能正常显示!!!
注意这里三处的名字一定一定要一样,不然就找不到不能正常显示!!!
注意这里三处的名字一定一定要一样,不然就找不到不能正常显示!!!
都不点赞都不点赞,生气了生气了(╯▔皿▔)╯
(╯▔皿▔)╯
(╯▔皿▔)╯
(╯▔皿▔)╯
(╯▔皿▔)╯
然后保存
就可以正常显示市了
一定要让他正常显示,正常显示后再发我
都不点个赞吗看到这里了(✺ω✺)