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 8045515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:34:20+00:00 2026-06-05T05:34:20+00:00

I have project with Google Maps v3. And I have problem with showing data

  • 0

I have project with Google Maps v3. And I have problem with showing data in infowindows of multiple marker. When I try to make infowindow for each markers, the map doesn’t show at all. I’m sure I’ve missed something but I don’t know what to do. So here is my code :

...
<script type="text/javascript">
        var pinImage = new google.maps.MarkerImage ("http://chart.apis.google.com/chart?chst=d_map_xpin_letter_withshadow&chld=pin_star|%E2%80%A2|CC3300|000000|FF9900",
        new google.maps.Size (70, 83),
        new google.maps.Point (0,0),
        new google.maps.Point (10,34));
    var pinShadow = new google.maps.MarkerImage ("http://chart.apis.google.com/chart?chst=d_map_pin_shadow",
        new google.maps.Size (89, 85),
        new google.maps.Point (0, 0),
        new google.maps.point (12, 35));
        var map;
    function initialize() {
    var myLatlng = new google.maps.LatLng(41.258531,-96.012599);
    var myOptions = {
    zoom: 2,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    var infoWindow = new google.maps.InfoWindow;
    <?php
    $posisi = array();
    $keterangan = array();
    foreach ($integer as $lokasi) {
    $query = "SELECT cl.locId, cl.country as country, cl.region as region, cl.city as city, cl.postalCode as postalCode, cl.latitude as latitude, cl.longitude as longitude, cl.metroCode as metroCode, cl.areaCode as areaCode
    FROM (SELECT locId as idcihuy FROM cityblocks WHERE $lokasi BETWEEN startIpNum AND endIpNum) cb, citylocation cl WHERE cb.idcihuy = cl.locId";
    $result = mysql_query($query);
    while ($location = @mysql_fetch_assoc($result)){
    $posisi[]= 'new google.maps.LatLng(' . $location['latitude'] . ', ' . $location['longitude'] . ')';
    $keterangan[]= '(' . $location['country'] . ', ' . $location['region'] . ', ' . $location['city'] . ')';
    }
    }
    ?>
     var keterangan = new Array();
 var point = [<?php echo implode(',', $posisi) ?>];
 var lokasi = [<?php echo implode(',', $keterangan) ?>];
 var icon = pinImage;
 for (var i = 0; i < point.length; i++) {
 var html = "<b>" + lokasi[i] + "</b> <br/>" + point[i];
     var marker = new google.maps.Marker({
        map: map,
        position: point[i],
        icon: pinImage,
        shadow: pinShadow
        });
        bindInfoWindow(marker, map, infoWindow, html);
        }
        }
    function bindInfoWindow(marker, map, infoWindow, html) {
      google.maps.event.addListener(marker, 'click', function() {
        infoWindow.setContent(html);
        infoWindow.open(map, marker);
      });
    }
    </script>

And this is the HTML code (browser output) :

...
var pinImage = new google.maps.MarkerImage ("http://chart.apis.google.com/chart?chst=d_map_xpin_letter_withshadow&chld=pin_star|%E2%80%A2|CC3300|000000|FF9900",

        new google.maps.Size (70, 83),

        new google.maps.Point (0,0),

        new google.maps.Point (10,34));

    var pinShadow = new google.maps.MarkerImage ("http://chart.apis.google.com/chart?chst=d_map_pin_shadow",

        new google.maps.Size (89, 85),

        new google.maps.Point (0, 0),

        new google.maps.point (12, 35));

        var map;

    function initialize() {

    var myLatlng = new google.maps.LatLng(41.258531,-96.012599);

    var myOptions = {

    zoom: 2,

    center: myLatlng,

    mapTypeId: google.maps.MapTypeId.ROADMAP

    }

    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    var infoWindow = new google.maps.InfoWindow;

         var keterangan = new Array();

     var point = [new google.maps.LatLng(20.0000, 77.0000),new google.maps.LatLng(20.0000, 77.0000),new google.maps.LatLng(38.0000, -97.0000),new google.maps.LatLng(51.7500, -1.2500)];

     var lokasi = [(IN, , ),(IN, , ),(US, , ),(GB, K2, Oxford)];

     var icon = pinImage;

     for (var i = 0; i < point.length; i++) {

      var html = "<b>" + lokasi[i] + "</b> <br/>" + point[i];

     var marker = new google.maps.Marker({

        map: map,

        position: point[i],

        icon: pinImage,

        shadow: pinShadow

        });

        bindInfoWindow(marker, map, infoWindow, html);

        }

        }

    function bindInfoWindow(marker, map, infoWindow, html) {

      google.maps.event.addListener(marker, 'click', function() {

        infoWindow.setContent(html);

        infoWindow.open(map, marker);

      });

    }

    </script>

Please help me o fix this problem. I really really need the help.
Thank You.

  • 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-05T05:34:23+00:00Added an answer on June 5, 2026 at 5:34 am

    Capitalize point to Point in this line: (shadow) new google.maps.Point (12, 35));

    Now you are missing quotes in the JavaScript lokasi, because it’s not a proper array. So html never gets built.

    I believe this line in PHP

    $keterangan[]= '(' . $location['country'] . ', ' . $location['region'] . ', ' . $location['city'] . ')';
    

    Should be more like this (notice the added ” next to the parentheses)

    $keterangan[]= '"(' . $location['country'] . ', ' . $location['region'] . ', ' . $location['city'] . ')"';
    

    so that the Javascript looks like this

    var lokasi = ["(IN, , )","(IN, , )","(US, , )","(GB, K2, Oxford)"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problem with adding Google Maps to my project. When i get
In my project.gwt.xml file I have <script src=http://maps.google.com/maps?gwt=1&amp;file=api&amp;v=2&amp;sensor=false;key=MYKEY /> But, when I load my
In my project, i have imported some third party frameworks like google-maps. EveryThing work
I am trying to learn about Google maps API. I have a project that
I have a problem with Google Maps in my Android app. I've switched to
Just doing a small project relating to google maps. Basically I have coordinates in
I have a page in my project that's using the google maps api along
I have been trying to compile the project from http://www.shabdar.org/google-maps-user-control-for-ASP-Net-part1.html but it is complaining
I have routes as Google Maps Polylines in my project (an example, http://rutasgdl.com/rutas/626-2 )
I'm having some problems with a project I'm doing using Google Maps. I have

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.