微信开发系列之八 - 微信公众号的地图集成

简介: 微信开发系列之八 - 微信公众号的地图集成

文章系列目录

Wechat development series 1 – setup your development environment

Wechat development series 2 – development Q&A service using nodejs

Wechat development series 3 – Trigger C4C Account creation in Wechat app

Wechat development series 4 – Send C4C Data change notification to Wechat app

Wechat development series 5 – embedded your UI5 application to Wechat app

Wechat development series 6 – Retrieve Wechat User info via oAuth2 and display it in UI5 application

Wechat development series 7 – use Redis to store Wechat conversation history

Wechat development series 8 – Map integration

Wechat development series 9 – Create C4C Social Media Message and Service within Wechat app

Wechat development series 10 – Use Wechat app to receive Service Request reply made from C4C

In Wechat development series 5 – embedded your UI5 application to Wechat app we have learned the steps how to put a web page into the Wechat app. Use the same approach, we can enable our subscription account with a little bit more feature: the map integration.

When a user has subscribed the test account, the Map integration menu is available:image.pngimage.pngThe user can type the address manually and press button “Search” to locate the address in the map view.image.pngimage.pngYou can use the control highlighted below to zoom in / out the map or switch the map type.

image.pngimage.pngThere are many free map providers available and in this blog I choose a popular provider in China: Baidu map. The same idea could be applied to other map provider as well.

In fact all the map related functionality such as location search, result render and the controls mentioned above are all implemented by map provider, all our needed to develop is just a wrapper html page where we get the search address input by end user, and call the search API, that’s all.

The functionality I show in this blog only needs 100 lines of html code to implement, unbelievable?


(1) Create a folder named “map”, and two files “baidu.js” and “bmap.css” inside it, whose source code could be found from my github.


(2) create an index.html and paste the following source code:image.pngimage.pngimage.pngI didn’t use any frontend framework to make this example simple and easily understood. When the map view is initially rendered, onload function findDefaultLocation() will be fired to locate the hard coded address “成都” in the map. End user can also change this address maintained in textarea and press search button to locate new address, implemented by function search().image.png(3) Add one line below in server.js, to support route based on url /map to the created folder in step one.image.pngRedeploy the whole application to cloud platform.

After that the index.html could be accessed via url in my laptop:image.png4) Create a new menu for your Wechat subscription account by calling Restful API with the following payload:image.pngow the whole scenario could be tested from your Wechat application.


相关文章
|
5月前
|
前端开发 开发者
【微信公众号对接】有关签名一直报错,提示invalid signature问题(我的签名和使用微信开发者工具验证返回的签名的是一致的)但还是报错!!!
【微信公众号对接】有关签名一直报错,提示invalid signature问题(我的签名和使用微信开发者工具验证返回的签名的是一致的)但还是报错!!!
173 0
|
2月前
|
小程序 开发者
微信开发者工具如何集成SVN、同时解决集成SVN无效果的问题
这篇文章介绍了如何在微信开发者工具中集成SVN版本控制系统,并提供了解决集成后无效果问题的方法。
微信开发者工具如何集成SVN、同时解决集成SVN无效果的问题
|
2月前
|
存储 人工智能 API
阿里云百炼应用实践系列-10分钟在企业微信中集成一个 AI 助手
在阿里云平台上,您只需十分钟,无需任何编码,即可在企业微信上为您的组织集成一个具备大模型能力的AI助手。此助手可24小时响应用户咨询,解答各类问题,尤其擅长处理私域问题,从而成为您企业的专属助手,有效提升用户体验及业务竞争力。
|
2月前
|
小程序 开发者
第一个微信小程序的初始化过程、小程序微信开发平台的下载、如何注册一个微信小程序的账号
这篇文章介绍了微信小程序的初始化过程,包括如何注册微信小程序账号、下载微信小程序开发者平台,并指导了新建小程序的详细步骤。
第一个微信小程序的初始化过程、小程序微信开发平台的下载、如何注册一个微信小程序的账号
|
4月前
|
数据采集 DataWorks 安全
DataWorks产品使用合集之选择独享调度,数据集成里可以使用,但是数据地图里面测试无法通过,是什么原因导致的
DataWorks作为一站式的数据开发与治理平台,提供了从数据采集、清洗、开发、调度、服务化、质量监控到安全管理的全套解决方案,帮助企业构建高效、规范、安全的大数据处理体系。以下是对DataWorks产品使用合集的概述,涵盖数据处理的各个环节。
42 0
DataWorks产品使用合集之选择独享调度,数据集成里可以使用,但是数据地图里面测试无法通过,是什么原因导致的
|
2月前
|
前端开发 JavaScript API
微信公众号项目,实现微信支付(具体流程和参数)
微信公众号项目,实现微信支付(具体流程和参数)
|
4月前
|
小程序 定位技术
uniapp微信小程序地图全屏显示配送范围
uniapp微信小程序地图全屏显示配送范围
|
4月前
|
安全 定位技术 API
探讨如何在Flutter中集成支付、地图等第三方服务,以及集成过程中需要注意的问题和最佳实践
【6月更文挑战第11天】本文介绍了在Flutter中集成第三方服务,如支付和地图,以增强应用功能和用户体验。开发者可通过官方或社区插件集成服务,注意服务选择、API调用、错误处理和用户体验。支付集成涉及选择服务、获取API密钥、引入插件、调用API及处理结果。地图集成则包括选择地图服务、获取API密钥、初始化地图组件和添加交互功能。集成时要选择稳定插件、仔细阅读文档,处理错误,优化性能并遵循安全规范。随着Flutter生态发展,更多优质服务将可供选择。
84 2
|
3月前
|
XML Java 数据格式
支付系统----微信支付20---创建案例项目--集成Mybatis-plus的补充,target下只有接口的编译文件,xml文件了,添加日志的写法
支付系统----微信支付20---创建案例项目--集成Mybatis-plus的补充,target下只有接口的编译文件,xml文件了,添加日志的写法
|
3月前
|
XML 关系型数据库 MySQL
支付系统----微信支付19---集成MyBatis-plus,数据库驱动对应的依赖版本设置问题,5没版本没有cj这个依赖,mysql驱动默认的是版本8,这里是一个父类,数据库都有,写个父类,继承就行
支付系统----微信支付19---集成MyBatis-plus,数据库驱动对应的依赖版本设置问题,5没版本没有cj这个依赖,mysql驱动默认的是版本8,这里是一个父类,数据库都有,写个父类,继承就行

热门文章

最新文章

下一篇
无影云桌面