Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8090815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:50:50+00:00 2026-06-05T19:50:50+00:00

Am playing with Google Maps V3 API and StyledMarkers. The data is derived from

  • 0

Am playing with Google Maps V3 API and StyledMarkers. The data is derived from a PHP/MySQL query returning several hundred points.

The code below returns everything I need and works fine EXCEPT for getting it to zoom to an approriate level (which in this case I know is 10).

<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title><?php echo returnval("event_name","events",$_GET['eid']); ?> Map - No Refresh</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="StyledMarker.js"></script>
<script type="text/javascript">
function initialize() {
  var myLatLng = new google.maps.LatLng(<?php echo $evlat; ?>, <?php echo $evlng; ?>);
  var bounds = new google.maps.LatLngBounds();
  var myOptions = {
    zoom: 9,
    center: myLatLng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  var map = new google.maps.Map(document.getElementById("show_map"), myOptions);
<?php
  $iconcntr = 0;
  while ($row = mysql_fetch_array($result)) {
    $iconcntr ++;
    $rfa_no = $row['rfa_no'];
    $longitude = $row['longitude'];
    $latitude = $row['latitude'];
    if ($row['rfa_priority'] == 1) {
      $iconclr = "FF0000";
    } elseif ($row['rfa_priority'] == 2) {
      $iconclr = "FFFF00";
    } else {
      $iconclr = "FFFFFF";
    }
?>
    var varLatLng = new google.maps.LatLng(<?php echo $latitude; ?>,<?php echo $longitude; ?>);
    bounds.extend(varLatLng);
    var styleMaker<?php echo $iconcntr; ?> = new StyledMarker({styleIcon:new StyledIcon(StyledIconTypes.BUBBLE,{color:"<?php echo $iconclr; ?>",text:"<?php echo $rfa_no; ?>"}),position:new google.maps.LatLng('<?php echo $latitude; ?>', '<?php echo $longitude; ?>'),flat:true,zIndex:<?php echo ($iconcntr+1000); ?>,map:map});
<?php
  }
?>
  map.fitbounds(bounds);
}
</script>

</head />
<body style="margin:0px; padding:0px;" onload="initialize()" />
<div id="show_map" style="width:100%; height:100%;"></div>
</body>
</html>

Anyone have any idea what I’m doing wrong? Not very strong in the programming department.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:50:52+00:00Added an answer on June 5, 2026 at 7:50 pm

    JavaScript is case-sensitive.

    Use map.fitBounds(bounds) instead of map.fitbounds(bounds). Documentation

    You should have seen an error in the Javascript Console about fitbounds not being a valid method or something similar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi all I was playing around with the Google Maps Directions API and in
I've been playing around with the google maps api through javascript (I'm also new
I'm playing around with Google Buzz API from Python, During the OAuth process when
I'm playing with the Google Maps API (v3) and I've run into an issue
I am playing around with the Google API Map Activity. Recently Google Maps for
I am playing around with the Google Maps API V3. I want to create
I was playing with Google maps for last two days and started understanding little
I'm reading some data for countries around the world and am playing with Google's
I am currently playing around with Google's Voice Recognition API for Android SDK. What
I've been using Google Maps Api for a while and I recently checked that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.