Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Google Maps Markers Not Showing

Posted on 2013-12-06
6
320 Views
Last Modified: 2014-01-16
We are displaying a number of markers on a Google Map V2 in a browser window in a Delphi application.  This has worked since 2010 when the feature was developed.  However, the markers have just stopped showing on the map.  We obtained a licence key from Google when we set up the project.  There are notes on the Goggle Maps site about quotas being exceeded and asks you to go to your console to view.  However, we can see no way of doing this.

Our code was copied from examples and uses the following template
<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"  
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
  <head> 
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
    <title>Google Maps JavaScript API Example</title> 
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<#KEY>&sensor=false" 
            type="text/javascript"></script> 
    <script type="text/javascript"> 
     function initialize() { 
      if (GBrowserIsCompatible()) { 
        function createMarker(point,html) {
          var marker = new GMarker(point);
          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(html);
          });
          return marker;
        }
        var map = new GMap2(document.getElementById("map_canvas")); 
        map.setCenter(new GLatLng(<#LAT>, <#LONG>), <#ZOOM>); 
        map.setUIToDefault(); 
        <#MARKERS>
      } 
    } 
    </script> 
  </head> 
  <body onload="initialize()" onunload="GUnload()"> 
    <div id="map_canvas" style="width:<#WIDTH>px; height: <#HEIGHT>px"></div> 
  </body> 
</html>

Open in new window

The <#XXX> tags are replaced with the required data.  The <#MARKER> tag is replaced with the required list of markers of the form
'var point = n.comew GLatLng(%s,%s); '+
           'var marker = createMarker(point,''%s''); '+
           'map.addOverlay(marker);

Open in new window

The %s placeholders are Lat, Long and the link to the markers detailed information.

Any one any idea why this should have stopped working.  I know that we are being encouraged to migrate to v3 of the API, but I have had no information on v2 being turned off.

Many thanks

Roger
0
Comment
Question by:rogerfg7
  • 3
  • 2
6 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39702450
If you are getting a message about exceeding quotas, then you need to contact Google support to find out how to increase the quotas.  They will probably tell you that you need a paid premium version.

Cd&
0
 

Author Comment

by:rogerfg7
ID: 39702968
No message about exceeding quotas, just markers not appearing.

Roger
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39703066
You need to switch to version 3. Version 2 was turned off on 19 November (2ish weeks ago).

Have a look here:

https://developers.google.com/maps/documentation/javascript/v2/reference
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:rogerfg7
ID: 39703372
Thanks.  I have re-done all the code except the info-window that pop-up when each marker was clicked.  Each market was added using
'var point = new GLatLng(<Lat>,<Long>); '+  
'var marker = new GMarker(position: point, <Info>); '+   
'map.addOverlay(marker);'

Open in new window

Simple.

v3 seems to need to create a separate infowindow for each marker and Listener events  for each marker, requiring each marker and infowindow to receive a unique name
'var marker1 = new google.maps.Marker({'+
'position: new google.maps.LatLng(<Lat>, <Long>),'+
'title: <Title>, map: map});'+
'var infowindow1 = new google.maps.InfoWindow({content: <Info>});'#13+
'google.maps.event.addListener(marker1, ''click'', function() {'+
'infowindow1.open(map,marker1);});'

Open in new window

Seems much more complicated, but I guess that's progress.
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39706613
It's no more complicated - in your original code the infowindow and click even were just wrapped in a separate function. So you would still have created a separate eventListener and infoWindow for each marker. Where you had this code:

var point = n.comew GLatLng(%s,%s);
var marker = createMarker(point,''%s''); '+
map.addOverlay(marker);

Open in new window

createMarker() was your own function that created the marker, added the click event and then showed the infoWindow.

You can wrap your new code in a function in the same way,
0
 

Author Comment

by:rogerfg7
ID: 39708430
Sorry, showing my unfamiliarity with JavaScript.  I have made the wrapper and simplified the call for each point.  Works fine.  Just need to get the nice rounded corners that the V2 infowindow had!  Many thanks.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question