当前位置:网站首页>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 .
边栏推荐
- Web3 DAPP user experience best practices
- 电脑的dwg文件怎么打开
- 为什么SQL语句命中索引比不命中索引要快?
- OLAP analysis engine kylin4.0
- JS, BOM, DOM (VI)
- 【FLink】access closed classloader classloader. check-leaked-classloader
- 为什么TCP握手刚刚好是3次呢?
- ThinkPHP 5 log management
- MySQL concept and operation (III)
- File upload vulnerability shooting range upload labs learning (pass1-pass5)
猜你喜欢

Region of Halcon: generation of multiple regions (3)

How to open the DWG file of the computer

在 .NET 6 中使用 dotnet format 格式化代码

ASEMI三相整流桥的工作原理

ThinkPHP 5 log management

JS' sort() function

dotnet-exec 0.4.0 released

【FLink】access closed classloader classloader. check-leaked-classloader

WPF 使用 MAUI 的自绘制逻辑

多睡觉,能减肥,芝加哥大学最新研究:每天多睡1小时,等于少吃一根炸鸡腿...
随机推荐
Wechat applet new version prompt update
Records of ros2/dds/qos/ topics
[Flink] problems and solutions of the continuous growth of checkpoint size in rocksdb incremental mode
Virtual honeypot Honeyd installation and deployment
ThinkPHP 5 log management
API interface management setup -eolinker4.0
Introduction to the hardest core PWN in the whole network_ Graphic analysis
ORA-00800: soft external error
Startup mode of SoC verification environment
cannot import name ‘escape’ from ‘jinja2’【成功解决】
分布式websocket搭建方案
华为鸿蒙开发第四课
Web3 DApp用户体验最佳实践
Kotlin Compose 监听软键盘 点击enter提交事件
How to download and use Xiaobai one click reload on the official website
Huawei Hongmeng development lesson 4
电脑的dwg文件怎么打开
领导:谁再用 Redis 过期监听实现关闭订单,立马滚蛋!
Heavy broadcast | phase shift method + mathematical principle derivation of multi frequency heterodyne + implementation
WPF 使用 MAUI 的自绘制逻辑