First of all, take a look at the polyline example:
http://code.google.com/apis/maps/documentation/javascript/examples/polyline-simple.html

Without seeing your complete code, you shouldn't be calling document.write.

Your code should look something like... (fill in the blanks)

var map = new google.maps.Map(...
var gliderPath = new google.maps.Polyline({
  map: map,
  path: route,
  strokeColor: "#ff0000",
  strokeOpacity: 1.0,
  strokeWeight: 2
});

Of course, insert this code after your generated "route" array from php is
in scope

On Fri, Sep 10, 2010 at 9:26 PM, fozz <[email protected]> wrote:

> I’m working with API3 and data downloaded from a gps in a .igc file.
>
> The objective is to show a polyline recorded while me and my buddies
> have been flying hangliders and paragliders. I understand why I should
> provide a link but I only have access to a testing server at present.
> I’ve been stuck on this for weeks so any help would be greatly
> appreciated. As you might guess, I’m not a programmer, perhaps I
> shouldn’t even be here!
>
> Using php  I have created two arrays of “lat” and “long” points, for
> example,
> lat[30] =12.345678
> long[30] =123.456789
>
> I’m stuck on how to create the polyline array “route” that will
> display on the map.
> This is what I have come up with so far but it does not work.
>
> <script language="JavaScript">
> var lat=new Array;//creates the javascript array(lat) from the php
> array
> var long=new Array;// as above for (long)
> <?php
>                for($i=0;$i<count($long); $i++){
>                        echo "lat[$i]='".$lat[$i]."';\n";
>                        echo "long[$i]='".$long[$i]."';\n";
>                        }
> ?>
> //document.write(lat[30]);//these both work eg 12.345678
> //document.write(long[30]);//eg 123.456789
>
>        var route = new Array; // Creating an array that will contain the
> points for the polyline
>        for (var i =0; i<lat.length; i++){
>        var lat = parseFloat(lat.attr("lat"));
>        var long = parseFloat(long.attr("long"));
>        var thispt = new google.maps.LatLng(lat, long);
>        route.push(thispt);
>        }
> document.write(route[30]);//this does not work!
> </script>
>
>
>

-- 
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