简体   繁体   中英

Google Maps Marker Not Appearing

I was trying to center the map at the calculated geographic center and then add markers to show the original points, as well as one for the center but they don't seem to be showing up. When I submit the data to getdata.php it just shows a blank screen. Does anyone see a problem with the javascript for the marker? Any help would be great. Thanks!

Did you check value of location[i] ? If you are in default [latitude, longitude] , try:

position: new google.maps.LatLng(location[i])

EDITED Try this again:

for(var i = 0; i<(<?php echo json_encode($counter); ?>;); i++ ){
   var marker = new google.maps.Marker({
        position: new google.maps.LatLng(latitudesoflocation[i], longitudesoflocation[i]),
        map: map,
        title: ("Point " + String.fromCharCode(94 + i))
});

There is a typo:

position: new google.maps.LatLng(latitudesoflocation[i],longitudesoflocation[i]);,
//______________________________________________________________________________^

remove the semicolon

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM