There's a lot missing from your posted code: the containsLatLng() function, the data in the msg variable, any errors shown in the browser's JavaScript console, etc.
It's going to be hard for anyone to guess what may be going wrong without seeing more. Can you post a link to the map page that is failing? On Wed, Feb 17, 2016 at 9:06 AM, 'Neetu Patel' via Google Maps JavaScript API v3 <google-maps-js-api-v3@googlegroups.com> wrote: > It stops suddenly in last 2 days. Before it was working fine. I am using > it in two places to find the marker position on map and the center of map > as highlighted. Please suggest. > > Following code I am using for your reference: > var ShowGlobalDonorMap = function (msg) { > var mapOptions = { > zoom: 4, > center: new google.maps.LatLng(50.971804, 10.623779), > mapTypeId: google.maps.MapTypeId.ROADMAP > }; > var cityPoints = []; > var map = new > google.maps.Map(document.getElementById(mapcontainerdiv), mapOptions); > var pointId = 0; > amountMin = msg[0].Income_Amt; > amountMax = msg[0].Income_Amt; > for (var i = 0; i < msg.length; i++) { > var position = new google.maps.LatLng(msg[i].Donor.LAT, > msg[i].Donor.LNG); > var existingId = containsLatLng(cityPoints, position); > if (existingId > -1) { > cityPoints[existingId].addr = cityPoints[existingId].addr > + "|" + msg[i].Donor.DONOR_NAME; > cityPoints[existingId].Total_Income = > cityPoints[existingId].Total_Income + msg[i].Income_Amt; > cityPoints[existingId].Income_Amt = > cityPoints[existingId].Income_Amt + "|" + msg[i].Income_Amt; > cityPoints[existingId].Income_Amt_Map = > cityPoints[existingId].Income_Amt_Map + "|" + msg[i].Income_Amt_Map; > cityPoints[existingId].code = cityPoints[existingId].code > + "|" + msg[i].Donor.DONOR_CODE; > cityPoints[existingId].totalPoints = > cityPoints[existingId].totalPoints + 1; > cityPoints[existingId].donorcategory = > cityPoints[existingId].donorcategory + "|" + msg[i].Donor.DONOR_CATEGORY; > } > else { > cityPoints[pointId] = { > center: position, > id: pointId, > addr: msg[i].Donor.DONOR_NAME, > Total_Income: msg[i].Income_Amt, > Income_Amt: msg[i].Income_Amt, > Income_Amt_Map: msg[i].Income_Amt_Map, > code: msg[i].Donor.DONOR_CODE, > pointType: 'rp', > totalPoints: 1, > donorcategory: msg[i].Donor.DONOR_CATEGORY > }; > pointId++; > } > > if (msg[i].Income_Amt < amountMin) > amountMin = msg[i].Income_Amt; > if (msg[i].Income_Amt > amountMax) > amountMax = msg[i].Income_Amt; > }; > > var i = cityPoints.length; > while (i--) { > GenerateMapCircle(cityPoints[i], "", i, map,'Global'); > > } > > // var legend = document.createElement('div'); > // legend.id = 'mapLegend'; > // var content = []; > // content.push('<div><div class="shade > one"></div>>80%</div>'); > // content.push('<div><div class="shade > two"></div>>60%</div>'); > // content.push('<div><div class="shade > three"></div>>40%</div>'); > // content.push('<div><div class="shade > four"></div>>20%</div>'); > // content.push('<div><div class="shade > five"></div><=20%</div>'); > // legend.innerHTML = content.join(''); > // legend.index = 1; > // > map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(legend); > }; > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps JavaScript API v3" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to google-maps-js-api-v3+unsubscr...@googlegroups.com. > To post to this group, send email to > google-maps-js-api-v3@googlegroups.com. > Visit this group at https://groups.google.com/group/google-maps-js-api-v3. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-js-api-v3+unsubscr...@googlegroups.com. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. Visit this group at https://groups.google.com/group/google-maps-js-api-v3. For more options, visit https://groups.google.com/d/optout.