none
Question about markers on the map RRS feed

  • Question

  • Hi, all

    I am using Bing map API to insert markers on the map, here is my code:

    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
        <meta charset="utf-8" />
        <script type='text/javascript'>
    	
        function GetMap() {
    		var map = new Microsoft.Maps.Map('#myMap', {
                credentials: '',
                center: new Microsoft.Maps.Location(26.9623200, -82.2113)
            });
    		
            var idlist = [
    			{id:010350, lat:26.916900, lng:-82.011860},
    			{id:020044, lat:28.725650, lng:-82.553100},
    			{id:030270, lat:25.864630, lng:-81.110600},
    			{id:030351, lat:26.153120, lng:-81.543680},
    			{id:090327, lat:27.169470, lng:-81.328800},
    			{id:100106, lat:28.027840, lng:-82.203470},
    			{id:140190, lat:28.207220, lng:-82.377200},
    			{id:140199, lat:28.235010, lng:-82.728190},
    			{id:160310, lat:28.184840, lng:-81.639650},
    			{id:170361, lat:27.099990, lng:-82.232380},
    			{id:180358, lat:28.674790, lng:-82.138520},
    			{id:280018, lat:29.840480, lng:-82.162570},
    			{id:320112, lat:30.599130, lng:-83.124930},
    			{id:340116, lat:29.560580, lng:-82.906080},
    			{id:370238, lat:30.311770, lng:-82.933610},
    			{id:460359, lat:30.493850, lng:-85.415860},
    			{id:470173, lat:30.443220, lng:-85.036430},
    			{id:470328, lat:30.230290, lng:-85.206040},
    			{id:480156, lat:30.525920, lng:-87.322450},
    			{id:480348, lat:30.947050, lng:-87.285870},
    			{id:500054, lat:30.681820, lng:-84.383610},
    			{id:530050, lat:30.989020, lng:-85.407530},
    			{id:530218, lat:30.755560, lng:-85.360990},
    			{id:530247, lat:30.982570, lng:-85.486750},
    			{id:550304, lat:30.496930, lng:-84.269100},
    			{id:550349, lat:30.623440, lng:-84.170300},
    			{id:590296, lat:30.220570, lng:-84.362420},
    			{id:600346, lat:30.992280, lng:-86.309200},
    			{id:610152, lat:30.746200, lng:-85.510480},
    			{id:610254, lat:30.685800, lng:-85.568160},
    			{id:700322, lat:28.715350, lng:-80.889650},
    			{id:730292, lat:29.536940, lng:-81.207160},
    			{id:740132, lat:30.718320, lng:-81.669050},
    			{id:750104, lat:28.541690, lng:-81.086340},
    			{id:750336, lat:28.452340, lng:-80.992060},
    			{id:760105, lat:29.610920, lng:-81.583550},
    			{id:860331, lat:25.988870, lng:-80.165510},
    			{id:860357, lat:26.145850, lng:-80.481020},
    			{id:880139, lat:27.652990, lng:-80.784280},
    			{id:890334, lat:27.204640, lng:-80.400180},
    			{id:900164, lat:25.168130, lng:-80.376530},
    			{id:900227, lat:24.669702, lng:-81.371320},
    			{id:920065, lat:28.156520, lng:-81.110590},
    			{id:930217, lat:26.893590, lng:-80.134250},
    			{id:930268, lat:26.616760, lng:-80.712190},
    			{id:940195, lat:27.391560, lng:-80.460520},
    			{id:940260, lat:27.439670, lng:-80.390390},
    			{id:970267, lat:25.802100, lng:-80.386240},
    			{id:970406, lat:28.492690, lng:-82.480640},
    			{id:970413, lat:26.464800, lng:-80.174440},
    			{id:970417, lat:26.935150, lng:-80.153710},
    			{id:970421, lat:27.419630, lng:-80.406740},
    			{id:970428, lat:28.622240, lng:-81.752120}
    			];
    
            var center = map.getCenter();
    
            //Create custom Pushpin
    		for (var count=0; count<idlist.length; count++){
    			var pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(idlist[count].lat, idlist[count].lng), {
                title: String(idlist[count].id),
    			});
    			//Add the pushpin to the map
    			map.entities.push(pin);
            };
        }
        </script>
        <script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap' async defer></script>
    </head>
    <body>
        <div id="myMap" style="width:1024px;height:768px;"></div>
    </body>
    </html>

    At first, the variable idlist have about one hundred elements for test, and then I change the idlist to about 30 elements, but when I open this page there are still about one hundred markers on the map.

    And I ask my friend to run this script at another computer, but number of markers are still incorrect.

    I'd appreciate any help.

    Yanyue Liu



    • Edited by Yanyue Liu Monday, April 8, 2019 10:49 AM
    Monday, April 8, 2019 8:28 AM

All replies

  • Hi Yanyue,

    You likely have the original version cached.  Try either another browser or clearing your cache.

    Sincerely,

    IoTGirl

    Monday, April 8, 2019 4:48 PM
    Owner
  • Hi loTGirl,

    Thank you for your reply, I try clearing cache of browser but it doesn't work.

    And I run this script at another computer that never use Bing map API before, but it doesn't work too.

    I thought that it may not concern local cache but remote cache?

    Yanyue Liu

    Friday, April 12, 2019 7:29 AM
  • to force the change on the same PC, copy the file, give it a new name and reload.
    Friday, April 12, 2019 3:46 PM
    Owner