其他分享
首页 > 其他分享> > 百度地图lng lat

百度地图lng lat

作者:互联网

 

 

public static function getLngLat($lng,$lat)
    {
        echo $lng.'___'.$lat;
        echo "\n";
        $ak = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';

        $callback=array('cityCode'=>0,'cityName'=>'');
        $apiUrl='http://api.map.baidu.com/geocoder/v2/?location='.$lat.','.$lng.'&output=json&coordtype=wgs84ll&pois=1&ak='.$ak;
        $ret = json_decode(file_get_contents($apiUrl),true);

        echo "\n\n\n\n";
        print_r($ret);
        echo "\n\n";

        if($ret['status']==0){
            $callback['cityCode']=$ret['result']['cityCode'];
            $callback['cityName']=$ret['result']['addressComponent']['city'];

        }


        return $callback;
    }

 

 

Array
(
    [status] => 0
    [result] => Array
        (
            [location] => Array
                (
                    [lng] => 116.45633588097
                    [lat] => 39.928965504131
                )

            [formatted_address] => 北京市朝阳区工体东路甲13
            [business] => 朝外大街/朝外,东大桥,朝阳门
            [addressComponent] => Array
                (
                    [country] => 中国
                    [country_code] => 0
                    [country_code_iso] => CHN
                    [country_code_iso2] => CN
                    [province] => 北京市
                    [city] => 北京市
                    [city_level] => 2
                    [district] => 朝阳区
                    [town] => 
                    [town_code] => 
                    [distance] => 5
                    [direction] => 附近
                    [adcode] => 110105
                    [street] => 工体东路
                    [street_number] => 甲13
                )

            [pois] => Array
                (
                    [0] => Array
                        (
                            [addr] => 北京市朝阳区朝阳门外大街8号
                            [cp] =>  
                            [direction] => 北
                            [distance] => 127
                            [name] => 蓝岛大厦(朝阳店)
                            [poiType] => 购物
                            [point] => Array
                                (
                                    [x] => 116.45594002235
                                    [y] => 39.928136947956
                                )

                            [tag] => 购物;购物中心
                            [tel] => 
                            [uid] => bba87388f48f50b9bca8224a
                            [zip] => 
                            [parent_poi] => Array
                                (
                                    [name] => 
                                    [tag] => 
                                    [addr] => 
                                    [point] => Array
                                        (
                                            [x] => 0
                                            [y] => 0
                                        )

                                    [direction] => 
                                    [distance] => 
                                    [uid] => 
                                )

                        )

                    [1] => Array
                        (
                            [addr] => 北京市朝阳区三角路甲1
                            [cp] =>  
                            [direction] => 西北
                            [distance] => 120
                            [name] => 东大桥(地铁站)
                            [poiType] => 公交设施
                            [point] => Array
                                (
                                    [x] => 116.45694612452
                                    [y] => 39.928275273065
                                )

                            [tag] => 公交设施;地铁站
                            [tel] => 
                            [uid] => ec0c6064cc9ab83e4657268a
                            [zip] => 
                            [parent_poi] => Array
                                (
                                    [name] => 
                                    [tag] => 
                                    [addr] => 
                                    [point] => Array
                                        (
                                            [x] => 0
                                            [y] => 0
                                        )

                                    [direction] => 
                                    [distance] => 
                                    [uid] => 
                                )

                        )

                    [2] => Array
                        (
                            [addr] => 北京市朝阳区朝阳门外大街10号
                            [cp] =>  
                            [direction] => 东北
                            [distance] => 173
                            [name] => 昆泰大厦
                            [poiType] => 房地产
                            [point] => Array
                                (
                                    [x] => 116.45513154739
                                    [y] => 39.92819919429
                                )

                            [tag] => 房地产;写字楼
                            [tel] => 
                            [uid] => 72e57fd7b3a35ab6f8dc850a
                            [zip] => 
                            [parent_poi] => Array
                                (
                                    [name] => 
                                    [tag] => 
                                    [addr] => 
                                    [point] => Array
                                        (
                                            [x] => 0
                                            [y] => 0
                                        )

                                    [direction] => 
                                    [distance] => 
                                    [uid] => 
                                )

                        )

                    [3] => Array
                        (
                            [addr] => 北京市朝阳区工人体育场东路春平广场
                            [cp] =>  
                            [direction] => 西南
                            [distance] => 144
                            [name] => 交通银行(北京东大桥支行)
                            [poiType] => 金融
                            [point] => Array
                                (
                                    [x] => 116.45741324339
                                    [y] => 39.92952710249
                                )

                            [tag] => 金融;银行
                            [tel] => 
                            [uid] => a3e8341c868a79954afd3f4c
                            [zip] => 
                            [parent_poi] => Array
                                (
                                    [name] => 百富国际大厦
                                    [tag] => 房地产;写字楼
                                    [addr] => 北京市朝阳区工人体育场东路与朝阳门外大街交叉路口东北侧(春平广场)
                                    [point] => Array
                                        (
                                            [x] => 116.45763781977
                                            [y] => 39.930011229229
                                        )

                                    [direction] => 西南
                                    [distance] => 209
                                    [uid] => ebcc9ac6aad2942a85420e46
                                )

                        )

                    [4] => Array
                        (
                            [addr] => 北京市朝阳区工人体育场东路壹家宜家
                            [cp] =>  
                            [direction] => 南
                            [distance] => 136
                            [name] => 新生态国际公寓
                            [poiType] => 房地产
                            [point] => Array
                                (
                                    [x] => 116.45608375123
                                    [y] => 39.929886739825
                                )

                            [tag] => 房地产;住宅区
                            [tel] => 
                            [uid] => a5a9a4a1935b03275fd4fe1c
                            [zip] => 
                            [parent_poi] => Array
                                (
                                    [name] => 
                                    [tag] => 
                                    [addr] => 
                                    [point] => Array
                                        (
                                            [x] => 0
                                            [y] => 0
                                        )

                                    [direction] => 
                                    [distance] => 
                                    [uid] => 
                                )

                        )

                    [5] => Array
                        (
                            [addr] => 北京市朝阳门外大街1号金麒大厦1层
                            [cp] =>  
                            [direction] => 东
                            [distance] => 161
                            [name] => 中国工商银行(北京朝阳支行)
                            [poiType] => 金融
                            [point] => Array
                                (
                                    [x] => 116.45489798796
                                    [y] => 39.929132882453
                                )

                            [tag] => 金融;银行
                            [tel] => 
                            [uid] => 08fc93dfd44dc3ef9b68b40d
                            [zip] => 
                            [parent_poi] => Array
                                (
                                    [name] => 金麒大厦
                                    [tag] => 房地产;写字楼
                                    [addr] => 北京市朝阳区朝阳门外大街1号
                                    [point] => Array
                                        (
                                            [x] => 116.45455663187
                                            [y] => 39.929409528332
                                        )

                                    [direction] => 东
                                    [distance] => 208
                                    [uid] => 8fa14fc3e00fc86ef6eafc8f
                                )

                        )

                    [6] => Array
                        (
                            [addr] => 北京市朝阳区工人体育场东路20号
                            [cp] =>  
                            [direction] => 西南
                            [distance] => 244
                            [name] => 北京市民政局
                            [poiType] => 政府机构
                            [point] => Array
                                (
                                    [x] => 116.45770070115
                                    [y] => 39.93028787153
                                )

                            [tag] => 政府机构;行政单位
                            [tel] => 
                            [uid] => 0930a3b94a54585db11e36fb
                            [zip] => 
                            [parent_poi] => Array
                                (
                                    [name] => 春平广场
                                    [tag] => 购物;购物中心
                                    [addr] => 北京市朝阳区工人体育场东路20号
                                    [point] => Array
                                        (
                                            [x] => 116.4576917181
                                            [y] => 39.929969732786
                                        )

                                    [direction] => 西南
                                    [distance] => 209
                                    [uid] => 74331d22ad6c34ed17948e10
                                )

                        )

                    [7] => Array
                        (
                            [addr] => 朝外大街38号
                            [cp] =>  
                            [direction] => 东北
                            [distance] => 268
                            [name] => 北京市陈经纶中学(东大桥高中部)
                            [poiType] => 教育培训
                            [point] => Array
                                (
                                    [x] => 116.45448476743
                                    [y] => 39.927770385055
                                )

                            [tag] => 教育培训;中学
                            [tel] => 
                            [uid] => 97e2499e4e26d35c6f3e1b35
                            [zip] => 
                            [parent_poi] => Array
                                (
                                    [name] => 保罗大厦
                                    [tag] => 房地产;写字楼
                                    [addr] => 朝阳门外大街38号
                                    [point] => Array
                                        (
                                            [x] => 116.45415239439
                                            [y] => 39.927715054634
                                        )

                                    [direction] => 东北
                                    [distance] => 302
                                    [uid] => dffd631cd742e8bc39221c8f
                                )

                        )

                    [8] => Array
                        (
                            [addr] => 北京市朝阳区东大桥路5号
                            [cp] =>  
                            [direction] => 北
                            [distance] => 202
                            [name] => 北京东大肛肠医院
                            [poiType] => 医疗
                            [point] => Array
                                (
                                    [x] => 116.45596697152
                                    [y] => 39.927590561021
                                )

                            [tag] => 医疗;专科医院
                            [tel] => 
                            [uid] => d3120b765ede1d831894c68f
                            [zip] => 
                            [parent_poi] => Array
                                (
                                    [name] => 
                                    [tag] => 
                                    [addr] => 
                                    [point] => Array
                                        (
                                            [x] => 0
                                            [y] => 0
                                        )

                                    [direction] => 
                                    [distance] => 
                                    [uid] => 
                                )

                        )

                    [9] => Array
                        (
                            [addr] => 北京市朝阳区工人体育场东路20号
                            [cp] =>  
                            [direction] => 西南
                            [distance] => 209
                            [name] => 春平广场
                            [poiType] => 购物
                            [point] => Array
                                (
                                    [x] => 116.4576917181
                                    [y] => 39.929969732786
                                )

                            [tag] => 购物;购物中心
                            [tel] => 
                            [uid] => 74331d22ad6c34ed17948e10
                            [zip] => 
                            [parent_poi] => Array
                                (
                                    [name] => 
                                    [tag] => 
                                    [addr] => 
                                    [point] => Array
                                        (
                                            [x] => 0
                                            [y] => 0
                                        )

                                    [direction] => 
                                    [distance] => 
                                    [uid] => 
                                )

                        )

                )

            [roads] => Array
                (
                )

            [poiRegions] => Array
                (
                )

            [sematic_description] => 蓝岛大厦(朝阳店)北127米
            [cityCode] => 131
        )

)

 

标签:distance,direction,name,point,lat,lng,Array,百度,addr
来源: https://www.cnblogs.com/vip-deng-vip/p/15706315.html