Hi, When using the following code i get the markers on the map from the newly created dataset but no timeline events when scrolling the timeline:
var scheduleMode = 0, tm = TimeMap.init({ mapId: "map", // Id of map div element (required) timelineId: "timeline", // Id of timeline div element (required) options: { mapType: "road" },
tm.timeline._bands[0].addOnScrollListener(function(a){ if(scheduleMode === 0){ scheduleMode = 1; tm.datasets.events.hide(); var newEventDataset = tm.createDataset("newevents",{id:"newevents",title:"newevents",type:"basic" }); newEventDataset.loadItems(newEventDatasetItems); tm.refreshTimeline(); // Also tried tm.timelline.layout() return console.log(tm); } }); Any help in the right direction appreciated thanks.
> tm = TimeMap.init({
> mapId: "map", // Id of map div element (required)
> timelineId: "timeline", // Id of timeline div element
> (required)
> options: {
> mapType: "road"
> },
I assume up to here is just setup, and the rest of the code is actually
being run asynchronously, right? Otherwise you'd just be adding all items
at load time.
I'm not sure this is the best way to do this, but it's hard to tell without
a better understanding of what you're trying to do. In any case, the main
issue here is that your dataset doesn't have an eventSource tied to the
timeline - that's the data structure the timeline uses to hold events, and
you need to get a reference to the eventSource for the band where you want
the events to appear, or the timeline won't know about them. In most cases
(unless you're showing different events on different bands), there's only
one eventSource per TimeMap object, and there's an easy reference to it:
var newEventDataset = ...
newEventDataset.eventSource = tm.eventSource;
// etc
and that should probably do it. Let me know if that works -
2) For my own project, I published a KML through GeoMedia and opened it in Google Maps with no issues. However, this is the kml format of my placemark:
Question - How do get my format corrected without manually editing every placemark. I'm assuming <TimeStamp><when>2000-10-01</when></TimeStamp> is the key for the timeline.
Timemap.js has some ExtendedData support, and there's a hook for mapping
your tags to the names Timemap expects. So I think you can do something
like this:
datasets: [
{
type: "kml",
options: {
url: "your_data.kml", // KML file to load
// array of ExtendedData elements to look for
extendedData: ["InterruptionDate"],
tagMap: {
"InterruptionDate":"start"
}
}
}
]
The only issue here is that I'm not sure that Timemap.js can handle the
SchemaData / SimpleData form of ExtendedData - it just uses the untyped
Data elements, as far as I can see.
If this doesn't work, there are a few options:
- You might be able to do this with the extraTags parameter. Timemap uses
jQuery for the lookup, so I think you could use a complex selector for
this, e.g.
datasets: [
{
type: "kml",
options: {
url: "your_data.kml", // KML file to load
// array of ExtendedData elements to look for
extraTags: ["SimpleData[name='InterruptionDate']"],
tagMap: {
"SimpleData[name='InterruptionDate']":"start"
}
}
}
]
This might take some trial and error to get the mapping right.
> 2) For my own project, I published a KML through GeoMedia and opened it in
> Google Maps with no issues.
> However, this is the kml format of my placemark:
> Question - How do get my format corrected without manually editing every
> placemark. I'm assuming <TimeStamp><when>2000-10-01</when></TimeStamp>
> is the key for the timeline.
> To post to this group, send email to timemap-development@googlegroups.com.
> To unsubscribe from this group, send email to
> timemap-development+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/timemap-development?hl=en.