当前位置:网站首页>PHP calls map API
PHP calls map API
2022-06-25 04:53:00 【Kiway.】
PHP Call up the map API Reverse address resolution
Because the company needs to use the reverse address resolution of the map , To put it simply, longitude and latitude are converted into address information , I found it mainly according to the charge , As the company is involved in foreign business , Gaode map needs to charge for obtaining foreign longitude and latitude information , So I only know about Tencent maps and Baidu maps API.
Pass parameters into the method , Finally, use this link to call
(key The last string is obtained by registering and logging in , This item is false key, Just Tencent maps key The type of use is '-' Connected )
$url = 'https://apis.map.qq.com/ws/geocoder/v1/?location= '.$data['lat'].','.$data['lng'].'&key=HJOTq-QWAO1P-F1DK-Q132-1RQ5-NWRF3';
$urlContent = file_get_contents($url);
$urlContent = json_decode($urlContent, true);
// Get address information
$res->address .= $urlContent['result']['address']??'';
Put the link directly on the browser to print the effect picture :
Baidu Maps API
Pass parameters into the method , Finally, use this link to call
(ak The last string is obtained by registering and logging in , This item is false ak, Just Tencent maps ak The type of is a string )
$url = 'http://api.map.baidu.com/reverse_geocoding/v3/?ak=asSFSioIUQWtxVqeASDSAQWE41125ASDsad&output=json&coordtype=wqedsfasdq4112wqe&location=' . $res->lat . "," . $res->lng;
// Analysis of Baidu url
$urlContent = file_get_contents($url);
$urlContent = json_decode($urlContent, true);
// according to url Output address
$res->address .= $urlContent['result']['formatted_address'];
Put the link directly on the browser to print the effect picture :
Other interfaces are similar , You can get to their API see , Now many situations involve charging , Be careful to ask .
边栏推荐
- win11蓝牙无法连接怎么办?win11蓝牙无法连接的解决方法
- After the newly assigned variable of the applet is modified, the original variable will also be modified
- Machine learning deep learning -- Vectorization
- Vscade setting clang format
- 【FLink】access closed classloader classloader.check-leaked-classloader
- buuctf web
- JDBC (IV)
- 基于SSH实现的学生成绩管理系统
- Kotlin compose listens to the soft keyboard and clicks enter to submit the event
- 2.0SpingMVC使用RESTful
猜你喜欢

OLAP analysis engine kylin4.0

2.0springmvc uses restful

Two hours to take you into the software testing industry (with a full set of software testing learning routes)

【图像融合】基于matlab方向离散余弦变换和主成分分析图像融合【含Matlab源码 1907期】

Introduction to the hardest core PWN in the whole network_ Graphic analysis

Vscode 设置clang-format

leetcode1221. Split balance string

Virtual honeypot Honeyd installation and deployment
Triangle class (construction and deconstruction)

绝了!自动点赞,我用 PyAutoGUI!
随机推荐
OOP stack class template (template +ds)
渗透测试-目录遍历漏洞
为什么SQL语句命中索引比不命中索引要快?
Code scanning payment flow chart of Alipay payment function developed by PHP
WPF 使用 MAUI 的自绘制逻辑
【图像融合】基于matlab方向离散余弦变换和主成分分析图像融合【含Matlab源码 1907期】
Wechat likes to pay attention to the solution of invalid automatic reply
Part I Verilog quick start
[keil] GPIO output macro definition of aducm4050 official library
我的IC之旅——资深芯片设计验证工程师成长——“胡”说IC工程师完美进阶
Student achievement management system based on SSH
计算学生成绩等级(虚函数和多态)
ORA-00800: soft external error
Kotlin Compose 监听软键盘 点击enter提交事件
Upgrade PHP to php7 The impact of X (I). The problem of session retention. Keep login
Write shell script error summary
Virtual honeypot Honeyd installation and deployment
Difference between asemi high power FET and triode
Kotlin Compose 完善toDo项目 Surface 渲染背景 与阴影
Construction scheme of distributed websocket