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

  • Home
  • SEARCH
  • 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 6835253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:12:38+00:00 2026-05-26T23:12:38+00:00

I’ve got my map mostly rendering, but I keep getting an error in firebug

  • 0

I’ve got my map mostly rendering, but I keep getting an error in firebug stating that GDirections is not defined. This is the full error in firebug:

GDirections is not defined
initialize()?from=...ions%21 (line 39)
(?)()?from=...ions%21 (line 89)
F()jquery.min.js (line 19)
$(G=[function(), function()], K=function(), F=undefined)jquery.min.js (line 12)
F()jquery.min.js (line 19)
F()jquery.min.js (line 19)
[Break On This Error] gdir = new GDirections(map, document.getElementById("directions")); 

It seems like somehow I am not referencing the API right.

Also, don’t worry about the weird syntax of {{ addressable.lat }}. I am calling this from a Django template and that just passes in a value, in this case for the latitude.
This is the code:

 <script type="text/javascript"
        src="http://maps.google.com/maps/api/js?sensor=false">
</script>

<script type="text/javascript">
  function initialize() {
    var latlng = new google.maps.LatLng({{ addressable.lat }}, {{ addressable.lon }});
    var myOptions = {
      zoom: 15,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };

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

    var marker = new google.maps.Marker({
      position: latlng,
      map: map,
      title:"{{ addressable.company }}"});

      gdir = new GDirections(map, document.getElementById("directions"));
      GEvent.addListener(gdir, "load", onGDirectionsLoad);
      GEvent.addListener(gdir, "error", handleErrors);

      setDirections("Pittsburgh, PA", "{{ addressable.address}}", "en_US");
  }

      function setDirections(fromAddress, toAddress, locale) {
        gdir.load("from: " + fromAddress + " to: " + toAddress,
                  { "locale": locale });
      }

      function handleErrors(){
         if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
           alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
         else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
           alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);

         else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
           alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

         else if (gdir.getStatus().code == G_GEO_BAD_KEY)
           alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

         else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
           alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);

         else alert("An unknown error occurred.");

       }

      function onGDirectionsLoad(){
        // Use this function to access information about the latest load()
        // results.
      }
</script>
  • 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-05-26T23:12:38+00:00Added an answer on May 26, 2026 at 11:12 pm

    GDirections is part of API 2, but the rest of your code is in API 3 syntax. You should be using the DirectionsService instead. Also you’ve got references to GEvent as well which won’t work either.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Seemingly simple, but I cannot find anything relevant on the web. What is the
I need to clean up various Word 'smart' characters in user input, including but
i got an object with contents of html markup in it, for example: string

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.