Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

PHP - Parse dynamic Google Maps KML to extract polyline?

  • 27-04-2011 04:52PM
    #1
    Closed Accounts Posts: 3,689 ✭✭✭


    Hey,

    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.

    <LineString>
    <coordinates>
    THIS
    </coordinates>
    </LineString>

    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?

    Thanks!


Comments

Advertisement
Advertisement