On Oct 21, 3:12 pm, phicarre <[email protected]> wrote:
> Hi,
> I extract in PHP a list of points (= polygon) from a mysql database.
> $points = $row['Points'];
>
> The $points format is (val1,val2),(val3,val4), ...
>
> Now I would like to pass these points to a javascript function. I do:
> echo "my_function($points);";
What does $points *actually* hold? If it's a string like
"(1.1,9.4),(1.15,9.4),(1.2,9.35),..."
then you need
echo "my_function('$points');";
and the client will get
my_function('(1.1,9.4),(1.15,9.4),(1.2,9.35),...');
Your function can then strip out the brackets, split the resulting
string on commas to produce an array like
["1.1","9.4","1.15","9.4","1.2","9.35",...]
and then loop through it in pairs to get at values. Note that you will
also need to parseFloat each string to get a numeric value for
GLatLng.
A link would have been better. I might have guessed wrong.
Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-api?hl=en
-~----------~----~----~----~------~----~------~--~---