Ok, thank you so much for that!
Now it works indeed!
What I aim to do with this piece of javascript, is calculate the
length of several polylines, and then put a marker at a certain
distance on the polylines.
However, orignally I meant to put several paths in the computelength
function, but i guess this works aswell. [calling the function several
times and adding up the different lengths]
now I have to make some sort of construction to select which polyline
should be used at what distance, but I guess that is doable... as I've
seen examples with one polyline already, though not with multiple...
what is your advise on this?

Thanks a lot for your help! I really appreciate it!

On Oct 25, 1:20 pm, xelawho <[email protected]> wrote:
> you have a couple of problems
>
> - your script is in the head (which is a bad idea anyway) and gets
> rendered before the body, so your script runs before the page has a
> chance to render your input box, which is why you get "afstand is
> undefined" - because it does not exist at the time you are trying to
> populate it.
>
> move your script into the body section, with your html elements above
> it. that should solve it.
>
> - your polyline is undefined because of a scope issue. try putting the
> update() call at the end of your initialize function, instead of
> outside of it. and yes, as MymsMan says TilburgUni_TilburgReeshof_path
> should not have quotes.
>
> you can compute multiple paths. it would make more sense to me to pass
> the name of the path as an argument like
>
> update(TilburgUni_TilburgReeshof_path)
> update(TilburgReeshof_GilzeRijen_path)
>
> then
>
> function update(path) {
>         var afstand = google.maps.geometry.spherical.computeLength(path);
>         document.getElementById('afstand').value = afstand;
>         alert(afstand);
>
> }
>
> displaying the results is going to be another issue.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to