0

I am a newbie at using google map api v3 . I used

paths=polygon.getPath().getArray();

to fetch arrays of Coordinates from the polygon I just draw . Now how can I access each elements of paths when I send this array to another function. How can I access each lat and Lon from this array ? Please help

1
  • Fire up the console (Firebug, Dragonfly, ...) and have a look at console.log(paths) Commented Oct 31, 2013 at 6:39

1 Answer 1

2

So paths is an array of coordinates?

Loop over the array like so:

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

}

Within that for statement, you can then get the individual lat and lng values like so:

for (var i = 0; i < paths.length; i++) {
  lat = paths[i].lat();
  lng = paths[i].lng();
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.