span8
span4
span8
span4
To allow temporal mapping, all feature written to the KML format can be assigned a number of time-related attributes. In this example, the KMLTimeSetter is used to relate features to a single timestamp (i.e. this feature relates to time X). It shows how to animate the movement of a vehicle along a path.
Any feature (point or line) in KML can have time data associated with it. KML data have 2 time elements derived from the TimePrimitive element.
TimeStamp - specifies a single moment for a feature
TimeSpan - specifies a <begin> and <end> time for a feature.
KML time data adhere to the standard dateTime value defined in the XML specification available at https://www.w3.org
For example an XML dateTime value of:
2018-05-22T15:41:00-08:00
…equates to:
3:41 pm (Pacific Standard Time) on the 22nd May 2018.
In fact, the time component of this is not obligatory. Equally valid is:
2018-05-22
Note the 1 or 2 digit month & day – 2018-5-22 is not valid, use only 2 digits.
FME does not validate KML dates to provide a warning or error in the log. The only way to find that there is a problem is when you open the dataset within Google Earth. To reduce problems use the DateTimeConverter transformer to construct dates in FME in either the FME DateTime format or the XML Schema time format.
KML timestamps can be applied in FME Workbench using the KMLTimeSetter transformer. The parameters dialog allows the author to select the time of time primitive (TimeStamp or TimeSpan) and select the time(s) from various attributes. In reality the transformer is merely setting the format attribute kml_timestamp_when (TimeStamp) or the kml_timespan_begin and kml_timespan_end (TimeSpan).
“ElectricCarTrack.json” is read with the JSON Reader; it consists of GPS data from an electric car.
Source ElectricCarTrack.json in Data Inspector
Alternatively, please run the Complete workspace template from the Downloads section.
Generate new workspace and set source data to ElectricCarTrack.json(see Downloads) and Output to Google KML.
Input GPS data contains Latitude and Longitude values. Add VertexCreator after the reader feature type and set the values as shown below.
KML formats can only accept this data in the XML dateTime structure, ISO DateTime (%Y-%m-%dT%H:%M:%S). The input data contains date value in a different format, so we have to format it.
NOTE: Setting Output Format to FME should generate the same result.
Use KMLStyler to set an icon for each point. In transformer properties and expand Icon and set the Name to gme/gx_cabs.
The JSON reader does not have Coordinate System support (Reader Overview). We have to use CoordinateSystemSetter to set the value to LL84(WGS84 datum, Lat/Longs, Degrees).
Run the workspace, then inspect the output in Google Earth:
ElectricCarTrack.kml in Google Earth
When a KML dataset contains TimeStamp or TimeSpan tags, Google Earth automatically detects these and adds an extra control for managing the display. Google Earth automatically select the beginning and ending for time slider based on the earliest and latest time found on features in the file. Take note of the “play” or “run” button, on Google Earth. Clicking this should enable animation. The time bar moves slowly along the scale from the minimum to the maximum value, and features within the main display get turned on and off according to whether their time stamp (or time span) falls within the current date range. Various options allow the user to adjust the speed of the display, and the date range to be displayed:
© 2019 Safe Software Inc | Legal