{"id":13755179,"url":"https://github.com/baidumapapi/wxapp-jsapi","last_synced_at":"2025-05-10T00:31:38.667Z","repository":{"id":15744702,"uuid":"78596536","full_name":"baidumapapi/wxapp-jsapi","owner":"baidumapapi","description":"百度地图微信小程序jsapi","archived":false,"fork":false,"pushed_at":"2022-05-18T09:22:40.000Z","size":37,"stargazers_count":468,"open_issues_count":12,"forks_count":240,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-11-16T09:33:57.696Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/baidumapapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-11T02:51:39.000Z","updated_at":"2024-11-07T09:05:06.000Z","dependencies_parsed_at":"2022-08-29T18:01:20.844Z","dependency_job_id":null,"html_url":"https://github.com/baidumapapi/wxapp-jsapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidumapapi%2Fwxapp-jsapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidumapapi%2Fwxapp-jsapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidumapapi%2Fwxapp-jsapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidumapapi%2Fwxapp-jsapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baidumapapi","download_url":"https://codeload.github.com/baidumapapi/wxapp-jsapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253346488,"owners_count":21894264,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T10:00:48.157Z","updated_at":"2025-05-10T00:31:37.935Z","avatar_url":"https://github.com/baidumapapi.png","language":"JavaScript","funding_links":[],"categories":["实用库"],"sub_categories":[],"readme":"# 百度地图微信小程序JS API v1.1\n\n## 相关链接\n[百度地图开放平台](https://lbs.baidu.com/)  \n[百度地图微信小程序JSAPI服务](https://lbs.baidu.com/index.php?title=wxjsapi)  \n\n## 更新日志\n* 2017.01.11：发布v1.0版本，支持search、suggestion、regeocoding和weather四种接口。\n\n* 2017.02.15：修复location参数无效的bug。\n\n* 2019.07.03：发布v1.1版本，增加geocoding接口，支持地址信息到经纬度的转换。\n\n* 2020.09：由于ak鉴权限制，小程序端jsapi暂不支持天气服务，可以通过webAPI[天气服务](https://lbsyun.baidu.com/index.php?title=webapi/weather)调用。\n\n## 概述\n百度地图微信小程序JavaScript API（下文简称小程序JSAPI），对百度地图Web服务API中的部分lbs接口，按照微信小程序的规范进行了前端JS封装，以方便微信小程序开发者的调用。\n\n部分接口对返回的POI等数据按照微信小程序的数据格式进行了处理，可直接用于小程序的map中。\n\n目前开放的小程序JSAPI接口和调用的WebAPI接口对应关系为：\n\n 小程序JSAPI            | Web服务API        \n---------------------- | -------------\n search                | Place API的周边检索部分\n suggestion            | Place Suggestion API\n regeocoding           | Geocoding API的逆地址解析部分\n geocoding             | Geocoding API的正地址解析部分\n \n## 目录结构\n\u003edemo ------------- 小程序JSAPI完整DEMO  \n\u003esrc  --------------- 小程序JSAPI源码   \n\u003e\n\n## 类参考\n\u003ch3\u003eBMapWX\u003c/h3\u003e\n此类是小程序JSAPI的核心类。  \n\n ### 构造函数:\n\n 构造函数                | 描述          \n---------------------- | -------------\n BMapWX(ak: string)    | 创建 BMapWX对象时，必须要传入ak\n \n ### 方法:\n \n  方法名                | 返回值              | 描述\n---------------------- | -------------------| -----\n search([searchParam](#1.1): Object)| none          | 进行search检索，检索周边POI信息\n suggestion([suggestionParam](#2.1): Object)| none   | 进行suggestion检索，根据内容进行模糊检索匹配，输入补全\n regeocoding([regeocodingParam](#3.1): Object)| none | 进行regeocoding检索，根据经纬度获得对应的地理描述信息\n geocoding([geocodingParam](#5.1): Object)| none     | 进行geocoding检索，根据经纬度获得对应的地理描述信息\n \n ### 参数:\n \n \u003ch4 id=\"1.1\"\u003esearchParam: Object\u003c/h4\u003e\n search检索参数对象结构\n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n location              | string             | 否      |经纬度例如：39.915,116.404 默认值为当前定位点\n iconPath              | string             | 是      |小程序marker图标\n iconTapPath           | string             | 否      |小程序点击后图标\n width                 | number             | 否      |marker宽，默认为图片宽度 \n height                | number             | 否      |marker高，默认为图片高度 \n alpha                 | number             | 否      |marker透明度，默认为1\n query                 | string             | 否      | 检索关键字，默认为生活服务、美食、酒店\n success               | Function([searchSuccess](#1.2))|否   | 检索成功后回调回调函数\n fail                  | Function([searchFail](#1.3))|否      | 检索失败后回调函数\n \n 其他参数和[Place API](http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-placeapi)请求参数一致。\n \n \u003ch4 id=\"1.2\"\u003esearchSuccess: Object\u003c/h4\u003e\n search检索成功回调函数的参数 \n   \n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n wxMarkerData          | Array              | 是      |小程序格式的marker对象数组，参考[微信文档](https://mp.weixin.qq.com/debug/wxadoc/dev/component/map.html?t=201715#markers)\n originalData          | Object             | 是      |Place API请求返回[全部原始数据](http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-placeapi)\n \n \u003ch4 id=\"1.3\"\u003esearchFail: Object\u003c/h4\u003e\n search检索失败回调函数的参数  \n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n errMsg                | string             | 是     |错误信息\n statusCode            | number             | 是     |错误状态码\n \n \n \u003ch4 id=\"2.1\"\u003esuggestionParam: Object\u003c/h4\u003e\n suggestion检索参数对象结构\n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n success               | Function([suggestionSuccess](#2.2))|否   | 检索成功后回调函数\n fail                  | Function([suggestionFail](#2.3))|否      | 检索失败后回调函数\n \n 其他参数和[Place Suggestion API](http://lbsyun.baidu.com/index.php?title=webapi/place-suggestion-api)请求参数一致。\n \n \u003ch4 id=\"2.2\"\u003esuggestionSuccess: Object\u003c/h4\u003e\n suggestion检索成功回调函数的参数  \n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n originalData          | Object             | 是      |Place Suggestion API请求返回[全部原始数据](http://lbsyun.baidu.com/index.php?title=webapi/place-suggestion-api)\n \n \u003ch4 id=\"2.3\"\u003esuggestionFail: Object\u003c/h4\u003e\n suggestion检索失败回调函数的参数  \n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n errMsg                | string             | 是     |错误信息\n statusCode            | number             | 是     |错误状态码\n \n \u003ch4 id=\"3.1\"\u003eregeocodingParam: Object\u003c/h4\u003e\n regeocoding检索参数对象结构\n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n location              | string             | 否      |要解析的经纬度例如：39.915,116.404 默认值为当前定位点\n iconPath              | string             | 是      |小程序marker图标\n iconTapPath           | string             | 否      |小程序点击后图标\n width                 | number             | 否      |marker宽，默认为图片宽度 \n height                | number             | 否      |marker高，默认为图片高度 \n alpha                 | number             | 否      |marker透明度，默认为1\n success               | Function([regeocodingSuccess](#3.2))|否   | 检索成功后回调函数\n fail                  | Function([regeocodingFail](#3.3))|否      | 检索失败后回调函数\n \n 其他参数和[Geocoding](https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding-abroad)请求参数一致。\n \n \u003ch4 id=\"3.2\"\u003eregeocodingSuccess: Object\u003c/h4\u003e\n regeocoding检索成功回调函数的参数  \n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n wxMarkerData          | Array              | 是      |小程序格式的marker对象数组，参考[微信文档](https://mp.weixin.qq.com/debug/wxadoc/dev/component/map.html?t=201715#markers)\n originalData          | Object             | 是      |Geocoding API请求返回[全部原始数据](http://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding-abroad)\n \n \u003ch4 id=\"3.3\"\u003eregeocodingFail: Object\u003c/h4\u003e\n regeocoding检索失败回调函数的参数  \n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n errMsg                | string             | 是     |错误信息\n statusCode            | number             | 是     |错误状态码\n \n \u003ch4 id=\"5.1\"\u003egeocodingParam: Object\u003c/h4\u003e\n geocoding检索参数对象结构\n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n address               | string             | 是      |待解析地址，如\"北京市海淀区上地十街10号\"\n iconPath              | string             | 是      |小程序marker图标\n iconTapPath           | string             | 否      |小程序点击后图标\n width                 | number             | 否      |marker宽，默认为图片宽度 \n height                | number             | 否      |marker高，默认为图片高度 \n alpha                 | number             | 否      |marker透明度，默认为1\n success               | Function([geocodingSuccess](#5.2))|否   | 检索成功后回调函数\n fail                  | Function([geocodingFail](#5.3))|否      | 检索失败后回调函数\n \n 其他参数和[Geocoding](https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding)请求参数一致。\n \n \u003ch4 id=\"5.2\"\u003egeocodingSuccess: Object\u003c/h4\u003e\n geocoding检索成功回调函数的参数  \n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n wxMarkerData          | Array              | 是      |小程序格式的marker对象数组，参考[微信文档](https://mp.weixin.qq.com/debug/wxadoc/dev/component/map.html?t=201715#markers)\n originalData          | Object             | 是      |Geocoding API请求返回[全部原始数据](http://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding)\n \n \u003ch4 id=\"5.3\"\u003egeocodingFail: Object\u003c/h4\u003e\n geocoding检索失败回调函数的参数  \n \n  属性名                | 类型                | 是否必须| 描述\n---------------------- | -------------------|--------| -----\n errMsg                | string             | 是     |错误信息\n statusCode            | number             | 是     |错误状态码\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaidumapapi%2Fwxapp-jsapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaidumapapi%2Fwxapp-jsapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaidumapapi%2Fwxapp-jsapi/lists"}