Baidu API Locator Returns the current detailed location

Source: Internet
Author: User

BaiduMap API is a set of free for developers based on BaiduThe application interface of the map, including JavaScript, IOS, andriod, static maps, Web services and many other versions, provide basic maps, location search, peripheral search 、...
<script type= "Text/javascript" src= "http://api.map.baidu.com/api?v=2.0&ak= (Baidu Apikey, own application)" ></script ><input type= "text" name= "Address" value= ""/><script type= "Text/javascript" > $ (function () {/** Baidu ground Figure API function **/var mapset = {getlocation:function () {var geolocation = new Bmap.geolocation ()                ;                        Geolocation.getcurrentposition (function (r) {if (this.getstatus () = = bmap_status_success) {                        var rp = new Bmap.point (R.point.lng,r.point.lat);                        var gc = new Bmap.geocoder ();                            Gc.getlocation (Rp,function (RS) {var addcomp = rs.addresscomponents;  $ ("Input[name= ' address ']"). Val (addcomp.province + "," + addcomp.city + "," + Addcomp.district + "," + Addcomp.street + "                        "," + addcomp.streetnumber);                    }); }},{enablehighaccuracy:true})           }        };        $ (function () {mapset.getlocation ();    });     });</script>


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Baidu API Locator Returns the current detailed location

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.