Java从高德地图获取全国地铁站数据
Java从高德地图获取全国地铁站数据。
数据来源(高德地图):http://map.amap.com/subway/index.html?&4401
采集代码
/*** 从高德地图地铁线路同步全国地铁站数据(非必要不调用)* 数据来源:http://map.amap.com/subway/index.html?&4401*/
// @GetMapping("/subwayParser")public void subwayParser() {String[] links = {"https://map.amap.com/service/subway?_1684218661470&srhdata=1100_drw_beijing.json","https://map.amap.com/service/subway?_1684218693712&srhdata=3100_drw_shanghai.json","https://map.amap.com/service/subway?_1684218708196&srhdata=4401_drw_guangzhou.json","https://map.amap.com/service/subway?_1684218719262&srhdata=4403_drw_shenzhen.json","https://map.amap.com/service/subway?_1684218731379&srhdata=4201_drw_wuhan.json","https://map.amap.com/service/subway?_1684218743629&srhdata=1200_drw_tianjin.json","https://map.amap.com/service/subway?_1684218759393&srhdata=3201_drw_nanjing.json","https://map.amap.com/service/subway?_1684218773376&srhdata=8100_drw_xianggang.json","https://map.amap.com/service/subway?_1684218803777&srhdata=5000_drw_chongqing.json","https://map.amap.com/service/subway?_1684217707451&srhdata=3301_drw_hangzhou.json","https://map.amap.com/service/subway?_1684218833591&srhdata=2101_drw_shenyang.json","https://map.amap.com/service/subway?_1684218852774&srhdata=2102_drw_dalian.json","https://map.amap.com/service/subway?_1684218869557&srhdata=5101_drw_chengdu.json","https://map.amap.com/service/subway?_1684218886740&srhdata=2201_drw_changchun.json","https://map.amap.com/service/subway?_1684218905074&srhdata=3205_drw_suzhou.json","https://map.amap.com/service/subway?_1684218920973&srhdata=4406_drw_foshan.json","https://map.amap.com/service/subway?_1684218936956&srhdata=5301_drw_kunming.json","https://map.amap.com/service/subway?_1684218956105&srhdata=6101_drw_xian.json","https://map.amap.com/service/subway?_1684218976721&srhdata=4101_drw_zhengzhou.json","https://map.amap.com/service/subway?_1684219002370&srhdata=4301_drw_changsha.json","https://map.amap.com/service/subway?_1684219044819&srhdata=3302_drw_ningbo.json","https://map.amap.com/service/subway?_1684219064385&srhdata=3202_drw_wuxi.json","https://map.amap.com/service/subway?_1684219087401&srhdata=3702_drw_qingdao.json","https://map.amap.com/service/subway?_1684219109584&srhdata=3601_drw_nanchang.json","https://map.amap.com/service/subway?_1684219127182&srhdata=3501_drw_fuzhou.json","https://map.amap.com/service/subway?_1684219147299&srhdata=4419_drw_dongguan.json","https://map.amap.com/service/subway?_1684219174915&srhdata=4501_drw_nanning.json","https://map.amap.com/service/subway?_1684219192214&srhdata=3401_drw_hefei.json","https://map.amap.com/service/subway?_1684219209797&srhdata=5201_drw_guiyang.json","https://map.amap.com/service/subway?_1684219228846&srhdata=3502_drw_xiamen.json","https://map.amap.com/service/subway?_1684219243963&srhdata=2301_drw_haerbin.json","https://map.amap.com/service/subway?_1684219261162&srhdata=1301_drw_shijiazhuang.json","https://map.amap.com/service/subway?_1684219275594&srhdata=6501_drw_wulumuqi.json","https://map.amap.com/service/subway?_1684219292478&srhdata=3303_drw_wenzhou.json","https://map.amap.com/service/subway?_1684219308833&srhdata=3701_drw_jinan.json","https://map.amap.com/service/subway?_1684219330534&srhdata=6201_drw_lanzhou.json","https://map.amap.com/service/subway?_1684219353633&srhdata=3204_drw_changzhou.json","https://map.amap.com/service/subway?_1684219370051&srhdata=3203_drw_xuzhou.json","https://map.amap.com/service/subway?_1684219391167&srhdata=1401_drw_taiyuan.json","https://map.amap.com/service/subway?_1684219404866&srhdata=1501_drw_huhehaote.json","https://map.amap.com/service/subway?_1684219420149&srhdata=4103_drw_luoyang.json"};// 输出数组中的链接for (String link : links) {String subwayData = HttpUtil.get(link, 10000);
// log.info("抓取到的地铁站数据:data = {}", subwayData);JSONObject jsonObject = new JSONObject(subwayData);List<AppSubwayData> appSubwayDataList = new ArrayList<>();// 获取城市名称String city = jsonObject.getString("s");log.info("城市: " + city);// 获取线路信息JSONArray lineArray = jsonObject.getJSONArray("l");for (int i = 0; i < lineArray.length(); i++) {JSONObject lineObject = lineArray.getJSONObject(i);// 获取线路名称String lineName = lineObject.getString("ln");log.info("线路名称: " + lineName);String lineIdentifier = lineObject.getString("ls");log.info("线路标识: " + lineIdentifier);JSONArray stationArray = lineObject.getJSONArray("st");for (int j = 0; j < stationArray.length(); j++) {JSONObject stationObject = stationArray.getJSONObject(j);AppSubwayData appSubwayData = new AppSubwayData();// 按照"地铁"分隔字符串String[] subwayArray = city.split("地铁");appSubwayData.setName(subwayArray[0].trim());appSubwayData.setCityName(city);appSubwayData.setLineName(lineName);appSubwayData.setLineIdentifier(lineIdentifier);// 获取站点名称String stationName = stationObject.getString("n");log.info("站名: " + stationName);appSubwayData.setStation(stationName);// 获取经纬度String coordinates = stationObject.getString("sl");String[] latLng = coordinates.split(",");double latitude = Double.parseDouble(latLng[0]);double longitude = Double.parseDouble(latLng[1]);log.info("经度: " + latitude);appSubwayData.setLatitude(BigDecimal.valueOf(latitude));log.info("纬度: " + longitude);appSubwayData.setLongitude(BigDecimal.valueOf(longitude));appSubwayDataList.add(appSubwayData);}}if (CollectionUtil.isNotEmpty(appSubwayDataList)) {boolean saveBatch = this.appSubwayDataService.saveBatch(appSubwayDataList);if (saveBatch) {log.info("成功保存{}的地铁站数据{}条...", city, appSubwayDataList.size());}}}}
地铁站数据包含以下字段释义:
“s”: 城市名称 (“贵阳市地铁”)
“i”: 城市代码 (“5201”)
“l”: 地铁线路列表
“ln”: 线路名称 (“1号线”)
“su”: 线路状态 (“1” 表示开通,“0” 表示关闭)
“kn”: 线路显示名称 (“轨道交通1号线”)
“lo”: 线路方向 (“0” 表示起点到终点,“1” 表示终点到起点)
“lp”: 线路起始终止站索引列表 (例如, [“0 356”] 表示起始站索引为 0,终止站索引为 356)
“ls”: 线路标识
“cl”: 线路颜色代码
“la”: 线路备注
“x”: 线路类型
“li”: 线路编号列表
每条线路包含一个站点列表:
“st”: 站点列表
“rs”: 站点坐标(像素坐标,例如 “1552 1107”)
“udpx”: 上下行站点坐标列表
“su”: 站点状态 (“1” 表示开通,“0” 表示关闭)
“udsu”: 上下行站点状态列表
“n”: 站点名称 (“小孟工业园”)
“sid”: 站点ID
“p”: 站点坐标(像素坐标,例如 “1552 1107”)
“r”: 站点所属线路标识
“udsi”: 上下行线路标识列表
“t”: 站点类型
“si”: 站点标识
“sl”: 站点经纬度 (“106.709631,26.497717”)
“udli”: 上下行线路编号列表
“poiid”: 站点POI ID
“lg”: 站点级别
“sp”: 站点拼音简写
请注意,这些字段的具体含义可能根据实际应用或数据提供者的定义而有所不同。以上是一般情况下的字段释义,您可以根据您的具体需求进行适当的解释和使用。
数据
数据在这里~
传送链
Java从高德地图获取全国地铁站数据相关推荐
- Java 根据高德地图获取经纬度坐标
1: 申请高德服务key /*** @param addressName* @param cityName* @Description 根据高德地图, 通过地址获取经纬度坐标* @Throws* @R ...
- Java使用高德地图获取行驶距离等信息
步骤:(总共三个类,可直接复制使用) 官网文档:高德地图路径规划API地址 申请高德API使用的key(备注:key的类型要选择web服务) 发送http GET请求 获取结果 以下是代码 HTTP请 ...
- Java调用高德地图API根据详细地址获取经纬度
Java调用高德地图API根据详细地址获取经纬度 官方API:https://lbs.amap.com/api/webservice/guide/api/georegeo * Web服务API 地理/ ...
- 高德地图获取所在城市POI数据
由于小论文方向为电动汽车的路径规划,所以需要用到充电站的数据,因此需要从高德地图上爬充电站数据.本文学习自这篇文章. 高德有一个开放平台,点击进入,注册(登录)(有了账号之后返回首页)-控制台-应用管 ...
- java api从高德地图获取某个位置的经纬度
1.代码展示 import com.fasterxml.jackson.databind.JsonNode; import com.ning.http.client.AsyncHttpClient; ...
- 集合高德地图搜索--导出Excel数据 工具
第一个是高德地图接口返回的数据对象的domain类 @Getter @Setter public class DataClass {private String name; //名称private S ...
- python爬取地图地址_python爬取了高德地图一些地点的数据,爬出来数据大致情况如下:...
python爬取了高德地图一些地点的数据,爬出来数据大致情况如下: 下面是基本流程: 1.注册成为高德地图API开发者,网址http://lbs.amap.com/(主要是获取自己的keywords ...
- flutter集成高德地图获取位置
flutter集成高德地图获取位置 准备工作 在创建安卓应用 获取SHA1 获取当前位置 添加依赖 文件配置 build.gradle文件配置 AndroidManifest.xml配置 获取定位 准 ...
- 高德地图 获取不到dom节点_地图市场大浪淘沙,新老图商谁将扛起未来发展大旗?...
文|邻章 11月20日,老牌地图厂商四维图新发布公告,公布公司起诉百度案一审结果,希望借此向市场传达向好信息.随后百度立即表示将提起上诉,并对四维提起反诉. 双方的互诉究竟会如何收场,目前还不得而知, ...
最新文章
- mac环境下的linux光标快捷键
- 图像的线性变换的原理及OpenCV代码实现~
- 学计算机选电脑,大学准备学计算机,选怎样配置的电脑好?
- 分治:分治和动态规划的区别,二分检索递归和迭代方式实现
- [Qt教程] 第27篇 XML(一)使用DOM读取XML文档
- Git 从了解到放弃
- 解决JupyterLab中tqdm_notebook进度条不显示问题
- NoSuchMethodError: org.apache.avro.Schema.getLogicalType()Lorg/apache/avro/LogicalType;
- 【知识必备】如何优雅的退出应用和处理崩溃异常并重启
- poj1017----模拟
- 华为HG255d WEB刷OpenWrt
- [Linux]基于网络编程的智能机器小伴侣
- php smarty配置,PHP中使用Smarty模板目录结构配置
- 【硬件驱动系列】DirectSound vs ASIO
- KYLO的计算机网络知识总结
- 玩游戏计算机缺失msvcp140,游戏缺少msvcp140.dll错误提示怎么办解决方法
- jstl获取表格单元格值_表格单元格和位置绝对值
- Android Binder机制(1):Binder架构分析
- jquery实现HTML复选框变单选框
- u3m8缓存文件.ts合成mp4
热门文章
- matlab 车辆 pdf,关于MATLAB图像处理车辆检测与识别.PDF
- gprs tcp 协议 汽车 服务器,基于GPRS的车辆检测通信系统设计毕业论文.doc
- 3天9亿!我爬取上万条评论解读《西虹市首富》并预测票房
- 用多态来实现U盘,Mp3,移动硬盘和电脑的对接,读取写入数据。
- ​LeetCode刷题实战69:x 的平方根
- mac Hadoop安装
- gitbash登录码云报错_git之sourceTree操作流程
- saltstack--sls文件
- 《微波技术基础》第二版 阅读随笔2
- vm虚拟机安装lede旁路由_教你利用VMM虚拟机安装LEDE旁路由实现软路由超强功能的方法教程...