GPS Visualizer

Generating a map from a KML file, dynamically

The tracks and markers on this map are pulled from the KML file shown below. If the data in the KML file is edited, the map will be updated the next time it is viewed.

Although waypoints in a KML file do not contain a "label" field -- which GPS Visualizer uses to put a "permanent" label on the map next to a marker -- the map's settings include a statement that synthesizes a label field using the "name" field.

gv_options.dynamic_data = {
  url:'barrett_spur.kml',
  synthesize_fields:{
    desc:'Elevation: {ele} meters',
    label:'{name}'
    folder:'Waypoints'
  },
  track_options:{color:'#0000E6',width:'3',opacity:'0.6'},
  autozoom:true, zoom_adjustment:0
};

To create a dynamic KML-derived map like this, just enter the URL of your KML file into the box labeled "URL that will be loaded into the map dynamically" in GPS Visualizer's Google Maps form.

NOTE: With some tweaking, this same setup can be used for just about any XML file, not just KML! It will also work if the data comes from a PHP script that generates KML-formatted output.



Contents of barrett_spur.kml: