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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:04:59+00:00 2026-05-11T17:04:59+00:00

I am playing around with Google Maps for the first time. And I am

  • 0

I am playing around with Google Maps for the first time. And I am struggling to extact some information about the location where the marker is.

I have set up an example for you to see. The problem happens when I drag the A-node, the getGeocode() returns undefined?

I need to extract zip-code, city, and address from the node when I drag it around.

Please see http://dev.korebogen.dk/gmap/

Thanks in advance!

Update

I edited my code from the responses – and now I get both addresses out (still need to strip it so I get the info in seperate variables) but for some reason my direction output turns out to be “0” and “1” (array) do I really need to reverse geocode that aswell?

And is it possible to make a click event on the map to add A and B markers (if there is no directions when loading?) http://dev.korebogen.dk/gmap/ is updated!

It comes from:

var param = i + "@" + newMarkers[i].getLatLng().y + "," + newMarkers[i].getLatLng().x;

This is the updated part:

GEvent.addListener(newMarkers[i], "dragend", function() {
            var points = [];
            for (var i = 0; i < newMarkers.length; i++) {
                var param = i + "@" + newMarkers[i].getLatLng().y + "," + newMarkers[i].getLatLng().x;
                //points[i] = newMarkers[i].getLatLng();
                points.push(param);
                if (!i) {
                    var x = new GClientGeocoder();

                    x.getLocations(newMarkers[0].getLatLng(), function(addresses) {
                        if (addresses.Status.code == 200) {
                            var address = addresses.Placemark[0].address;
                            document.getElementById("start").innerHTML = address;
                        }
                    });

                    x.getLocations(newMarkers[1].getLatLng(), function(addresses) {
                        if (addresses.Status.code == 200) {
                            var address = addresses.Placemark[0].address;
                            document.getElementById("end").innerHTML = address;
                        }
                    });
                }
            }
            gdir.loadFromWaypoints(points);

        });
  • 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-11T17:04:59+00:00Added an answer on May 11, 2026 at 5:04 pm

    The problem here is that the object you are getting back from your loadFromWaypoints request is not populated with all the members that you are asking for in onGDirectionsLoad (). If you a look in your javascript error log you will see:

    Error: gdir.getRoute(0).getStartGeocode().AddressDetails.Country is undefined

    Ok, according to the Google Documention, the response from loadFromWaypoints and GClientGeodcoder should be identical.

    I took the liberty of doing some testing with your sample and it suddenly becomes obvious that the responses are not the same. If you have a look at http://www.cannonade.net/geo.js, you can see that I stringify the GClientGeocoder request and the response for the first marker and they are very different. So you need to do a couple of things:

    • Check your responses to ensure that you don’t get javascript errors for unpopulated results:

      if (‘AddressDetails’ in resp)

    • Do a GClientGeocoder request for each marker point to get the full address information. My sample does this for the first marker.

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

Sidebar

Related Questions

I'm playing around with Google maps for the first time, so I looked at
Playing around with Google Maps these days, with some directions. I have a map
I was just playing around a bit with google maps and wanted to add
I am trying to write some google map functionlity and playing around with javascript
I am playing around with the Google Maps API V3. I want to create
Im playing around with NHibernate 3 alpha but struggling to set up my SessionFactory.
I was playing around with my own Sudoku solver and was looking for some
I am playing around with MVC and have started setting up an existing site
So I have been playing around with a home project that includes a lot
I'm playing around with Google Buzz API from Python, During the OAuth process when

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.