[GIS] Draw lines and Move the marker at the same time with KML format

kmlline

it is possible to draw a line and put the Marker in the top of the line with KML format? or have i to make two KML files, it's that to say, One KML file for the Lines and another one for The Markers?
We are about to develop a GIS track app, and we are testing what is the best way to achieve our project.

here is and example, about what we want to do:
GIS Track Example, Moving line and Marker

Well is good to explain, that we gonna get a new KML or the data every 20 seconds to redraw the lines and the markers in the map.

Or do you have better ideas? KML, Database(Mysql), Xml?

Thanks to all.

Best Answer

Well I did something for myself,since no one has responded, I've only managed to move the marker or icon ,i have a KML format to represent a plane track, in Openlayers Map, everything works great, but i can only see the plan track, i'd like to see the Line too, it is possible with the same KML file or have i to add something else? i'd, like to do something like this (Line and Point): Example

Thanks, here are the codes:

    filter = new OpenLayers.Filter.Comparison({
   type: OpenLayers.Filter.Comparison.BETWEEN,
   property: "when",
   lowerBoundary: startDate,
upperBoundary: new Date(startDate.getTime() + (parseInt(spanEl.value, 10) * 1000))
 });

 filterStrategy = new OpenLayers.Strategy.Filter({filter: filter});

 var flights = new OpenLayers.Layer.Vector("Aircraft Locations", {
projection: geographic,
strategies: [new OpenLayers.Strategy.Fixed(), filterStrategy],
protocol: new OpenLayers.Protocol.HTTP({
    url: "kml-track.kml",
    format: new OpenLayers.Format.KML({
        extractTracks: true,
        extractStyles: true ,// use style from KML instead of styleMap below
        extractAttributes: true
    })
}),
/*styleMap: new OpenLayers.StyleMap({
    "default": new OpenLayers.Style({
        graphicName: "circle",
        pointRadius: 3,
        fillOpacity: 0.25,
        fillColor: "#ffcc66",
        strokeColor: "#ff0000",
        strokeWidth: 2
        })
    }),*/
   //  renderers: ["Canvas", "SVG", "VML"]
   });

  map.addLayers([osm, flights]);
   map.setCenter(new OpenLayers.LonLat(-93.2735, 44.8349).transform(geographic, mercator), 8);

and with this KML:

<?xml version="1.0" encoding="UTF-8"?>
 <kml xmlns="http://www.opengis.net/kml/2.2"          xmlns:gx="http://www.google.com/kml/ext/2.2">
 <Document>
<Style id="departure">
 <LineStyle>
   <color>FF00FF00</color>
   <width>3</width>
 </LineStyle>
  <IconStyle>
    <Icon>
      <href>http://localhost/Openlayers/FilterStrategy/lotus.ico</href>
   </Icon>
 </IconStyle>
 </Style>

<Folder>
  <name>Departures</name>
  <Placemark>
    <name>TEX2</name>
     <flightid>HOOK67</flightid>
   <styleUrl>#departure</styleUrl>

    <gx:Track>
         <gx:altitudeOffset>0</gx:altitudeOffset>
          <tessellate>0</tessellate>
        <altitudeMode>relativeToGround</altitudeMode>
        <extrude>0</extrude>
        <when>2010-05-01T13:02:46-05</when>
        <when>2010-05-01T13:02:50-05</when>
        <when>2010-05-01T13:02:54-05</when>
        <when>2010-05-01T13:02:59-05</when>
        <when>2010-05-01T13:03:04-05</when>
        <when>2010-05-01T13:03:08-05</when>
        <when>2010-05-01T13:03:13-05</when>
        <when>2010-05-01T13:03:18-05</when>
        <when>2010-05-01T13:03:22-05</when>
        <when>2010-05-01T13:03:27-05</when>
        <when>2010-05-01T13:03:31-05</when>
        <when>2010-05-01T13:03:36-05</when>
        <when>2010-05-01T13:03:41-05</when>
        <when>2010-05-01T13:03:45-05</when>
        <when>2010-05-01T13:03:50-05</when>
        <when>2010-05-01T13:03:55-05</when>
        <when>2010-05-01T13:03:59-05</when>
        <when>2010-05-01T13:04:04-05</when>
        <when>2010-05-01T13:04:09-05</when>
        <when>2010-05-01T13:04:13-05</when>
        <when>2010-05-01T13:04:18-05</when>
        <when>2010-05-01T13:04:23-05</when>
        <when>2010-05-01T13:04:28-05</when>
        <when>2010-05-01T13:04:32-05</when>
        <when>2010-05-01T13:04:37-05</when>
        <when>2010-05-01T13:04:42-05</when>
        <when>2010-05-01T13:04:46-05</when>
        <when>2010-05-01T13:04:51-05</when>
        <when>2010-05-01T13:04:56-05</when>
        <when>2010-05-01T13:05:00-06</when>

                <gx:coord>-93.2379571205595 44.872806349747    365</gx:coord>
                <gx:coord>-93.2370660925484 44.870006118743 396</gx:coord>
                <gx:coord>-93.236355767523 44.8669752777211 426</gx:coord>
                <gx:coord>-93.2354887209031 44.863712193489 487</gx:coord>
                <gx:coord>-93.2347087148419 44.8604536579846 548</gx:coord>
                <gx:coord>-93.2338531241111 44.8572464977323 609</gx:coord>
                <gx:coord>-93.2329069833652 44.8540674818656 670</gx:coord>
                <gx:coord>-93.2321075679892 44.8508271074111 731</gx:coord>
                <gx:coord>-93.2318979317232 44.8475791496379 792</gx:coord>
                <gx:coord>-93.2324245825346 44.8444239832126 884</gx:coord>
                <gx:coord>-93.2337414411031 44.8414077607553 945</gx:coord>
                <gx:coord>-93.2358704572033 44.8386783246771 1006</gx:coord>
                <gx:coord>-93.2388663703645 44.836365445841 1066</gx:coord>
                <gx:coord>-93.2426861295915 44.8345537010783 1127</gx:coord>
                <gx:coord>-93.2472528925157 44.8333824186694 1158</gx:coord>
                <gx:coord>-93.252467378877 44.8329692039001 1188</gx:coord>
                <gx:coord>-93.25805239674 44.8333893976675 1219</gx:coord>
                <gx:coord>-93.2638450577518 44.8346083411457 1219</gx:coord>
                <gx:coord>-93.2696754993405 44.83650914188 1219</gx:coord>
                <gx:coord>-93.2753673121587 44.8390951418887 1219</gx:coord>
                <gx:coord>-93.2808543977574 44.8421681587795 1219</gx:coord>
                <gx:coord>-93.2861853262416 44.8454128516506 1249</gx:coord>
                <gx:coord>-93.29145969331 44.8487370983379 1219</gx:coord>
                <gx:coord>-93.2967095159 44.8520389729185 1219</gx:coord>
                <gx:coord>-93.3019214165294 44.8553364257712 1219</gx:coord>
                <gx:coord>-93.3070477220233 44.8587223340278 1219</gx:coord>
                <gx:coord>-93.3121286565238 44.8620050415952 1219</gx:coord>
                <gx:coord>-93.3171626530446 44.8652559523285 1219</gx:coord>
                <gx:coord>-93.3221179929219 44.868582313462 1219</gx:coord>
                <gx:coord>-93.3270963865766 44.8718050975636 1219</gx:coord>


  </gx:Track>
 </Placemark>
 </Folder>
</Document>
 </kml>