Hi
I am new to Google map. I read the tutorial site recommended by
google.
But I still have a lot of problem, I think I must missed something.
I have a myspl data base which stored over 900 buildings' address
(the actual address of the building, not the location on map)
I would like to get all the buildings to be shown on the map
however, I tried different code whole date but still can't get what I
want
can anyone help me? I am totally messed up
here is some of my code
<script type="text/javascript">
//<![CDATA[
//var om = new OverlayMessage(document.getElementById('map'));
//om.Set('<b>Loading...</b>');
var geocoder ;
var icon ;
var gicon ;
var map ;
var gmarkers = new Array();
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl()) ;
map.addControl(new GOverviewMapControl()) ;
var mm = new GMarkerManager(map, {borderPadding:1});
geocoder = new GClientGeocoder() ;
icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon.shadow = "http://labs.google.com/ridefinder/images/
mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
<?
foreach ($bp as $row) // I loaded the data from db to an array
{
echo 'var address ="'.$row['StreetName'].', '.district($row
['District']).', Hong Kong";';
echo 'showAddress(address);';
}
?>
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
function showAddress(address)
{
geocoder.getLatLng(address, function(point)
{
if (point)
{
html = address;
var marker = createMarker(point,html);
map.addOverlay(marker);
map.setCenter(point, 17);
//gmarkers.push(marker);
//mm.addMarkers(gmarkers, 0, 17);
//mm.refresh();
// I am trying to use GMarkerManager here, but....i couldn't get it
work..., the gmarkers alway return 0 arrays...
}
else
{
var start = new GLatLng(22.340844,114.109497);
map.setCenter(start, 11);
}
}) ;
}
//]]>
</script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---