Lukes
unread,May 25, 2011, 6:55:57 PM5/25/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-map...@googlegroups.com
Hello,
I'm trying to show addresses on the map, but not all the addresses are showed. My code looks as follows:
var map = null;
var geocoder = null;
bounds = new GLatLngBounds;
function createMarker(point, contentMoved, contentClicked, scale, present)
{
var ico = new GIcon(G_DEFAULT_ICON);
if(present > 0) ico.image = "./img/puppet_green.png";
else ico.image = "./img/puppet.png";
markerOptions = { icon:ico };
map.setCenter(point, scale);
var marker = new GMarker(point, markerOptions);
GEvent.addListener(marker, "click", function()
{
if(contentMoved != "") marker.openInfoWindowHtml(contentClicked);
});
GEvent.addListener(marker, "mouseover", function()
{
if(contentMoved != "") marker.openInfoWindowHtml(contentClicked);
});
return marker;
}
function showAddress(address, contentMoved, contentClicked, scale, present)
{
geocoder.getLatLng(
address, function(point)
{
if(point)
{
bounds.extend(point);
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
map.addOverlay(createMarker(point, contentMoved, contentClicked, scale, present));
}
}
);
}
function initialize()
{
map = new GMap2(document.getElementById("map_canvas"));
geocoder = new GClientGeocoder();
map.setUIToDefault();
<?php
foreach($dataArray as $currCity)
{
...
...
...
?>
showAddress('<?php echo $currCityArray[0] ?>', '<?php echo $stringMove ?>', '<?php echo $stringClick ?>', 5, <?php echo $sh ?>);
<?php
}
?>
}
So I'm generating the calls of showAddress function using PHP for loop. Problem is if I generate a lot of addresses, e.g. 30. About 10 addresses are showed correctly but the rest not. Addresses are correct - if I skip first 10 addresses, further 10 addresses are showed correctly.
So I'm a bit confused. Where could be a problem, please? Thanks a lot, Lukes.