Dynamic add multipoint location display based on Baidu API

Source: Internet
Author: User

As a beginner, but also self-study, a simple problem for others, for themselves is like an insurmountable mountain

But when the problem is solved by itself, the joy is unspeakable.

Recently in a multi-point location display, before doing a single-point positioning display of small cases, I would like to apply that, but did a lot of trying to find that no

Later consulted a lot of information, but also combined with Baidu map demo, finally in accordance with their own understanding out, here and everyone to share, master do not laugh

<script type= "Text/javascript" >    //Baidu Map API function    var map = new Bmap.map ("Allmap");    var point = new Bmap.point (116.404, 39.915);    Map.centerandzoom (point, N);    Enable wheel zoom to zoom      out map.enablescrollwheelzoom (true);    Write a custom function to create a callout function    Addmarker (point) {        var marker = new Bmap.marker (point);        Map.addoverlay (marker);    }    var lon = "<%=session[" longitude "]%>";//previous page read out from the database longitude information, stored to the string    var lat = "<%=session[" Latitude "]% > ";//The Latitude information that was read out from the database in the previous page, stored to the string    var Lonarr = new Array ();    Lonarr = Lon.split (",");//store to array    var Latarr = new Array ();    Latarr = Lat.split (","); Stores the    corresponding latitude and longitude information for the array//loop    (var i = 0; i < lonarr.length; i++) {        var point = new Bmap.point (Lonarr[i], l Atarr[i]);        Addmarker (point);        } </script>

Dynamic add multipoint location display based on Baidu API

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.