0
votes

I have some radar data to display with the Google Earth plugin. Generally, it is some ground objects with coordinates and a timestamp. I followed the instructions in https://developers.google.com/kml/documentation/time, tried both timestamp and timespan and it works fine. But the displaying effects are not satisfying.

For the timestamp solution, the placemarks just flash briefly at exactly the time indicated by "" tags. And when I pressed play button, nothing shows up on the map. Code sample:

<Folder>
  <name>Vehicles</name>
  <description>Timeline information of vehicles</description>
  <Placemark>
    <name>2</name>
    <description>(-84.114231,39.785436,-0.000216),V(13.411216,37.555181) at 0.00s</description>
    <TimeStamp>
      <when>2012-09-19T08:00:00Z</when>
    </TimeStamp>
    <styleUrl>#vehicleStyle</styleUrl>
    <Point>
      <coordinates>-84.114231,39.785436,-0.000216</coordinates>
    </Point>
  </Placemark>
  <Placemark>
    <name>910</name>
    <description>(-84.110335,39.788438,-0.000024),V(0.000000,0.000000) at 0.80s</description>
    <TimeStamp>
      <when>2012-09-19T08:00:30Z</when>
    </TimeStamp>
    <styleUrl>#vehicleStyle</styleUrl>
    <Point>
      <coordinates>-84.110335,39.788438,-0.000024</coordinates>
    </Point>
  </Placemark>
  <Placemark>
    <name>2</name>
    <description>(-84.114133,39.785494,-0.000285),V(13.411216,37.555118) at 0.80s</description>
    <TimeStamp>
      <when>2012-09-19T08:00:30Z</when>
    </TimeStamp>
    <styleUrl>#vehicleStyle</styleUrl>
    <Point>
      <coordinates>-84.114133,39.785494,-0.000285</coordinates>
    </Point>
  </Placemark>
  <Placemark>
    <name>910</name>
    <description>(-84.110307,39.788410,-0.000046),V(3.499966,307.390012) at 1.60s</description>
    <TimeStamp>
      <when>2012-09-19T08:01:00Z</when>
    </TimeStamp>
    <styleUrl>#vehicleStyle</styleUrl>
    <Point>
      <coordinates>-84.110307,39.788410,-0.000046</coordinates>
    </Point>
  </Placemark>
</Folder>
                ...

For the timespan case, the animation is OK but there is always a tail followed by each object: the placemarks in previous frames do not disappear immediately at the beginning of the new time span.

Code sample:

...
 <Folder>
  <name>Vehicles</name>
  <description>Timeline information of vehicles</description>
  <Placemark>
    <name>2</name>
    <description>(-84.114231,39.785436,-0.000216),V(13.411216,37.555181) at 0.00s</description>
    <TimeSpan>
      <begin>2012-09-19T08:00:00Z</begin>
      <end>2012-09-19T08:00:10Z</end>
    </TimeSpan>
    <styleUrl>#vehicleStyle</styleUrl>
    <Point>
      <coordinates>-84.114231,39.785436,-0.000216</coordinates>
    </Point>
  </Placemark>
  <Placemark>
    <name>910</name>
    <description>(-84.110335,39.788438,-0.000024),V(0.000000,0.000000) at 0.80s</description>
    <TimeSpan>
      <begin>2012-09-19T08:00:10Z</begin>
      <end>2012-09-19T08:00:20Z</end>
    </TimeSpan>
    <styleUrl>#vehicleStyle</styleUrl>
    <Point>
      <coordinates>-84.110335,39.788438,-0.000024</coordinates>
    </Point>
  </Placemark>
  <Placemark>
    <name>2</name>
    <description>(-84.114133,39.785494,-0.000285),V(13.411216,37.555118) at 0.80s</description>
    <TimeSpan>
      <begin>2012-09-19T08:00:10Z</begin>
      <end>2012-09-19T08:00:20Z</end>
    </TimeSpan>
    <styleUrl>#vehicleStyle</styleUrl>
    <Point>
      <coordinates>-84.114133,39.785494,-0.000285</coordinates>
    </Point>
  </Placemark>
  <Placemark>
    <name>910</name>
    <description>(-84.110307,39.788410,-0.000046),V(3.499966,307.390012) at 1.60s</description>
    <TimeSpan>
      <begin>2012-09-19T08:00:20Z</begin>
      <end>2012-09-19T08:00:30Z</end>
    </TimeSpan>
    <styleUrl>#vehicleStyle</styleUrl>
    <Point>
      <coordinates>-84.110307,39.788410,-0.000046</coordinates>
    </Point>
  </Placemark>
</Folder>
                ...

So is there any solution to make the placemarks animate continuously? Thanks.

P.S. Track is not considered, because tracking information between data points are not available for now.

1
It is really hard to know what you are actually asking here, could you try to reword the question? If you are using the Earth Plugin then it is probably better to handle any animation via the javascript api rather than in the Kml directly...Fraser
Sorry if I didn't make it clear. My problem is that I have a bunch of vehicle traces represented as some discrete points associated with timestamps. So if I play these frame by frame, the expected output may be some points moving continuously across the roads. The data are generated from some other programs and of very large volume. So I think it is easier to use kml as an interface between both sides.user2162367

1 Answers

0
votes

If I understand what you are asking then you could do this by simply toggling the style of the placemarks using the JavaScript api.

To do this you could simply create a style in your Kml document such as.

<Style id="vehicleStyleHighighted">
  <IconStyle>
     <color>ff00ff00</color>
     <colorMode>random</colorMode>
     <scale>1.5</scale>
     <Icon>
        <href>http://maps.google.com/mapfiles/kml/pal3/icon21.png</href>
     </Icon>
  </IconStyle>
</Style>

You can then use the method setStyleUrl() along with a timer to set each placemark's style. I.E. You would toggle each placemarks style between #vehicleStyleHighighted and '#vehicleStyleHighighted.

If you wanted more than a simple 'on/off' animation then you can define more than two animation states using this method and then simply apply them as required.