# base-map-api-starter **Repository Path**: houger/base-map-api-starter ## Basic Information - **Project Name**: base-map-api-starter - **Description**: 集成第三方地图API,如高德、百度。可通过配置文件快速调用,灵活切换。 - **Primary Language**: Java - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 8 - **Forks**: 0 - **Created**: 2022-08-04 - **Last Updated**: 2024-11-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # zhs-base-map-starter #### 介绍 集成第三方地图API,如高德、百度、腾讯。可通过配置文件快速调用,灵活切换。 也可以同时使用多个,支持平滑加权轮询、随机等负载均衡算法。 #### 安装教程 1. 添加依赖 ```xml com.zhs.base base-map-api-starter 1.0.0 ``` 2. application.yml添加配置 ```yaml map: amap: # amap key aMapKey: your key #weight: 12 # amap geo API url #aMapGeoUrl: https://restapi.amap.com/v3/geocode/geo?address= # amap regeo API url #aMapReGeoUrl: https://restapi.amap.com/v3/geocode/regeo?location= baidu: # baidu map ak baiduKey: your ak #weight: 12 # baidu map geocoding API url # default:https://api.map.baidu.com/geocoding/v3/?output=json&ret_coordtype=gcj02ll&address= #baiduGeoUrl: # baidu map reverse_geocoding API url # default:https://api.map.baidu.com/reverse_geocoding/v3/?output=json&coordtype=gcj02ll&ret_coordtype=gcj02ll&extensions_town=true&location= #baiduReGeoUrl: tencent: # tencent map ak tencentKey: your key #weight: 1 # tencent map geocoding API url # default:https://apis.map.qq.com/ws/geocoder/v1/?output=json&address= #tencentGeoUrl: # tencent map reverse_geocoding API url # default:https://apis.map.qq.com/ws/geocoder/v1/?output=json&location= #tencentReGeoUrl: # default: polling #load: #balance: #type: polling ``` 3. 注入使用 ```java @Resource MapApiManager mapApiManager; ``` #### 使用说明 注意:fastjson 版本在2.0.7以上方可使用 仅支持高德地图、腾讯地图、百度地图。推荐使用高德、腾讯,不推荐百度 高德文档:https://lbs.amap.com/api/webservice/guide/api/georegeo/#geo_list 腾讯文档:https://lbs.qq.com/service/webService/webServiceGuide/webServiceGcoder 百度文档:https://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-geocoding 如需打印日志,添加配置: ```yaml logging.level.com.zhs.base=INFO ```