The google maps client side scripts deal in KML files or in specific
objects, so I am assuming that you want to convert either on a server
side application or to statically convert files. In these two cases I
strongly recommend gpsbabel. In its command line form it could be
executed from a cgi script. The output can be re-directed via stdout
to a pipe.
John Phillips