当前位置:网站首页>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 .
边栏推荐
- great! Auto like, I use pyautogui!
- 本轮压力测试下,DeFi协议们表现如何?
- Upgrade PHP to php7 The impact of X (2), the obsolescence of mcrypt decryption
- dotnet-exec 0.4.0 released
- 华为鸿蒙开发第四课
- After the newly assigned variable of the applet is modified, the original variable will also be modified
- Which programming language is the most cumbersome to implement Hello world?
- 【Keil】ADuCM4050官方库的GPIO输出宏定义
- ORA-00800: soft external error
- DMA double buffer mode of stm32
猜你喜欢
The SQL response is slow. What are your troubleshooting ideas?
Machine learning deep learning -- Vectorization
Chapter IX app project test (2) test tools
ROS2/DDS/QoS/主题的记录
Region of Halcon: generation of multiple regions (3)
File upload vulnerability shooting range upload labs learning (pass1-pass5)
Record the problem of C # print size once
Upgrade PHP to php7 The impact of X (I). The problem of session retention. Keep login
What if win11 Bluetooth fails to connect? Solution of win11 Bluetooth unable to connect
dotnet-exec 0.4.0 released
随机推荐
华为鸿蒙开发第四课
Separation of storage and computing in Dahua cloud native database
ASEMI三相整流桥的工作原理
Why PHP is not safe
Le chemin de l'apprentissage immutable - - Adieu à la copie traditionnelle
File upload vulnerability shooting range upload labs learning (pass1-pass5)
OOP栈类模板(模板+DS)
JS call() and apply()
parallel recovery slave next change & parallel recovery push change
Join() in JSZ
基于Cortex-M3、M4的精准延时(系统定时器SysTick延时,可用于STM32、ADuCM4050等)
How to download and use Xiaobai one click reload on the official website
计算学生成绩等级(虚函数和多态)
Kotlin compose perfect todo project surface rendering background and shadow
Cannot import name 'escape' from 'jinja2' [solved successfully]
515. find the maximum value / Sword finger offer II 095 in each tree row Longest common subsequence
Fun CMD command line~
win11蓝牙无法连接怎么办?win11蓝牙无法连接的解决方法
Méthode de récupération des données d'ouverture du disque dur à l'état solide
【FLink】access closed classloader classloader.check-leaked-classloader