If you have a new account but are having problems posting or verifying your account, please email Niamh on [email protected] for help. Thanks :)
New AMA with a US police officer (he's back!). You can ask your questions here

PHP - Parse dynamic Google Maps KML to extract polyline?

  • 27-04-2011 4:52pm
    Closed Accounts Posts: 3,689 joeKel73


    I am working on a project that gets walking directions from Google Maps via a set of coordinates. Like this.

    I want to use that overlay, and can extract it by adding &output=kml to the URL like this.

    That's fine, but I only want the polyline element of the kml, how can I parse the KML url above to echo out just the coordinates that are within the line string and coordinates tag.


    I am hoping to echo out
    1. My own beginning of a KML, then open new polyline element
    2. the coordinates from above
    3. close the polyline element and continue with my own KML

    Any tips or directions how to parse the Google Maps KML URL?