Geochart Marler Placement Duplication

15 views
Skip to first unread message

Robert Seymour

unread,
Aug 21, 2025, 6:31:46 AMAug 21
to Google Visualization API
I created a map with Geochart markers for cities of BirdBreath followers around the world.


For some reason the markers for New Zealand on the far right,  are duplicated on the far left of the map.

I reduced the width, hoping to crop the image, but there was no change in the image.

Any idea why? 

Do you have any suggestions?

Thanks
Robert


Screenshot 2025-08-21 at 2.05.29 AM.png

Robert Seymour

unread,
Aug 21, 2025, 7:09:50 AMAug 21
to Google Visualization API
Here s the code:  I could find nothing as to why it is duplicated. I believe it is something internal.

<?php
?>

<html>
  <head>
    <script type='text/javascript' src='https://www.gstatic.com/charts/loader.js'></script>
    <script type='text/javascript'>
     google.charts.load('current', {
       'packages': ['geochart'],
       // Note: Because markers require geocoding, you'll need a mapsApiKey.
       // See: https://developers.google.com/chart/interactive/docs/basic_load_libs#load-settings
       'mapsApiKey': 'AIzaSyCsuCoCj9K2SZ0D7rM1Fqj0Xm73mwiodfQ'
     });
     google.charts.setOnLoadCallback(drawMarkersMap);

      function drawMarkersMap() {
      var data = google.visualization.arrayToDataTable([

  <?php  

            $cities = "citiesa.txt";    
            $file = fopen('citiesa.txt', "r");

      $data = file($cities);
    $name = $data[count($data)-1];

            echo "['City'],\n";
                 
    while(!feof($file)) {

        $city = fgets($file);
        $city1 = preg_replace("/\r\n|\r|\n/", '', $city);
        if (strpos($country, $name) !== false) {              
            echo "['$city']; \n";
        }else{
            echo "['$city1'],\n";
      }
      }
?>
      ]);

      var options = {
        //colorAxis: {colors: ['red','red']}
        displayMode: 'markers',
        defaultColor: 'red'
      };


      var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
      chart.draw(data, options);
    };
    </script>
  </head>
  <body>
    <?php require "header2.php";?>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
    <?php require "footer.php";?>

  </body>
</html>

Robert Seymour

unread,
Aug 21, 2025, 7:24:06 AMAug 21
to Google Visualization API
Screenshot 2025-08-21 at 4.10.18 AM.pngHowever, that segment of New Zealand does not seem to appear on my map of countries ..(same map)



On Thursday, August 21, 2025 at 3:31:46 AM UTC-7 Robert Seymour wrote:
Reply all
Reply to author
Forward
0 new messages