当前位置:网站首页>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 .
边栏推荐
- Use text analysis to identify the main gender in a text
- Filter & listener (XIV)
- Method of opening data recovery of solid state disk
- PostgreSQL database Wal - RM_ HEAP_ ID logging action
- The solution of wechat applet switchtab unable to take parameters
- Opensea PHP development kit
- Why is the TCP handshake just 3 times?
- olap分析引擎——Kylin4.0
- 写shell脚本报错总结
- 基于Cortex-M3、M4的精准延时(系统定时器SysTick延时,可用于STM32、ADuCM4050等)
猜你喜欢

《QDebug 2022年6月》

成功解决:selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from

Web3 DApp用户体验最佳实践

leetcode1221. Split balance string

What is Ethernet and how to connect the computer

How to use the Magic pig system reinstallation master

Paper notes: multi label learning ESMC (I don't understand it, but I haven't written it yet, so I'll put it here for a place temporarily)

At the age of 30, I began to learn programming by myself. Is it still time for me to have difficulties at home?

JS, BOM, DOM (VI)

魔法猪系统重装大师怎么使用
随机推荐
Chapter IX app project test (2) test tools
基于SSH实现的学生成绩管理系统
Machine learning deep learning -- Vectorization
Response (XI)
buuctf(re)
【FLink】access closed classloader classloader. check-leaked-classloader
ORA-00800: soft external error
Paper notes: multi label learning ESMC (I don't understand it, but I haven't written it yet, so I'll put it here for a place temporarily)
buuctf(pwn)
Upgrade PHP to php7 X (III) failure of wechat payment callback
[keil] GPIO output macro definition of aducm4050 official library
Sleep more, you can lose weight. According to the latest research from the University of Chicago, sleeping more than 1 hour a day is equivalent to eating less than one fried chicken leg
Huawei Hongmeng development lesson 4
30岁了开始自学编程,家里比较困难还来得及吗?
Swift rapid development
EL & JSTL (XIII)
dotnet-exec 0.4.0 released
基于Cortex-M3、M4的精准延时(系统定时器SysTick延时,可用于STM32、ADuCM4050等)
《QDebug 2022年6月》
Precise delay based on Cortex-M3 and M4 (systick delay of system timer can be used for STM32, aducm4050, etc.)