当前位置:网站首页>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 .
边栏推荐
- 30岁了开始自学编程,家里比较困难还来得及吗?
- JS' sort() function
- 2.0SpingMVC使用RESTful
- The SQL response is slow. What are your troubleshooting ideas?
- Google Earth engine (GEE) - Global jrc/gsw1_ 1 / batch download of yearlyhistory dataset (China region)
- Kotlin Compose 监听软键盘 点击enter提交事件
- File upload vulnerability shooting range upload labs learning (pass1-pass5)
- Méthode de récupération des données d'ouverture du disque dur à l'état solide
- 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
- Chapter IX app project test (2) test tools
猜你喜欢

为什么SQL语句命中索引比不命中索引要快?

Php7.2 add JPEG extension

halcon之区域:多种区域(Region)生成(3)

重磅直播 | 相移法+多频外差之数学原理推导+实现

Chapter IX app project test (2) test tools

Vscade setting clang format

Region of Halcon: generation of multiple regions (3)

buuctf(pwn)

Difference between asemi high power FET and triode

成功解决:selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from
随机推荐
本轮压力测试下,DeFi协议们表现如何?
JDBC (IV)
OOP vector addition and subtraction (friend + copy construction)
515. find the maximum value / Sword finger offer II 095 in each tree row Longest common subsequence
【图像融合】基于matlab方向离散余弦变换和主成分分析图像融合【含Matlab源码 1907期】
Filter & listener (XIV)
EL & JSTL (XIII)
How to make colleagues under the same LAN connect to their own MySQL database
PostgreSQL database Wal - RM_ HEAP_ ID logging action
2021-10-24
Virtual honeypot Honeyd installation and deployment
cannot import name ‘escape’ from ‘jinja2’【成功解决】
《牛客刷verilog》Part I Verilog快速入门
OOP栈类模板(模板+DS)
大话云原生数据库中的存算分离
为什么SQL语句命中索引比不命中索引要快?
epplus复制模板后打印区域变小的问题
There is 404 in the laravel visit, except the home page is redirected; Index php
Upgrade PHP to php7 The impact of X (2), the obsolescence of mcrypt decryption
[image fusion] image fusion based on MATLAB directional discrete cosine transform and principal component analysis [including Matlab source code 1907]