当前位置:网站首页>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 .
边栏推荐
- Separation of storage and computing in Dahua cloud native database
- leetcode1221. Split balance string
- 固态硬盘开盘数据恢复的方法
- Precise delay based on Cortex-M3 and M4 (systick delay of system timer can be used for STM32, aducm4050, etc.)
- [image fusion] image fusion based on MATLAB directional discrete cosine transform and principal component analysis [including Matlab source code 1907]
- How do the defi protocols perform under this round of stress test?
- Startup mode of SoC verification environment
- Region of Halcon: generation of multiple regions (3)
- WPF 使用 MAUI 的自绘制逻辑
- 计算学生成绩等级(虚函数和多态)
猜你喜欢

dotnet-exec 0.4.0 released

Records of ros2/dds/qos/ topics

File upload vulnerability shooting range upload labs learning (pass1-pass5)

以太网是什么要怎么连接电脑

Concat() in JS

leetcode1221. Split balance string

Student achievement management system based on SSH

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

WPF 使用 MAUI 的自绘制逻辑

Working principle of asemi three-phase rectifier bridge
随机推荐
Opensea PHP development kit
Record the problem of C # print size once
Vscode 设置clang-format
【Flink】RocksDB增量模式checkpoint大小持续增长的问题及解决
How to apply for software
魔法猪系统重装大师怎么使用
Teach you to write non maintainable PHP code step by step
华为鸿蒙开发第四课
Use text analysis to identify the main gender in a text
DMA double buffer mode of stm32
Concat() in JS
The SQL response is slow. What are your troubleshooting ideas?
How to use the Magic pig system reinstallation master
Kotlin compose perfect todo project surface rendering background and shadow
我的IC之旅——资深芯片设计验证工程师成长——“胡”说IC工程师完美进阶
parallel recovery slave next change & parallel recovery push change
Which programming language is the most cumbersome to implement Hello world?
Why PHP is not safe
STM32的DMA双缓冲模式详解
《牛客刷verilog》Part I Verilog快速入门