Hi Nick,
I am a new user of time map, and have some silly questions about progressive loading.
OK, I want to load my data progressively and what does the url used for? Because I don't know anything about PHP. and the whole project is based on javascript. Is the data is store in that location? Could I store my data locally?
I read the source code of the example and source code of json.js. then I find something in json.js:
/**
* @class
* JSON string loader factory - expects a plain JSON array.
*
* <p>The json_string loader assumes an array of items in plain JSON, with no
* callback function - this will require a local URL.</p>
* <p>Note that this loader requires lib/json2.pack.js.</p>
*
* @augments TimeMap.loaders.remote
*
* @requires lib/json2.pack.js
*
* @example
TimeMap.init({
datasets: [
{
title: "JSON String Dataset",
type: "json_string",
options: {
url: "mydata.json" // Must be a local URL
}
}
],
// etc...
});
*
* @param {Object} options All options for the loader
* @param {String} options.url URL of JSON file to load
* @param {mixed} [options[...]] Other options (see {@link TimeMap.loaders.remote})
*/
TimeMap.loaders.json_string = function(options) {
var loader = new TimeMap.loaders.remote(options);
/**
* Parse a JSON string into a JavaScript object, using the json2.js library.
* @name TimeMap.loaders.json_string#parse
* @function
* @param {String} json JSON string to parse
* @returns {Object} Parsed JavaScript object
*/
loader.parse = JSON.parse;
return loader;
};
// Probably the default json loader should be json_string, not
// jsonp. I may change this in the future, so I'd encourage you to use
// the specific one you want.
TimeMap.loaders.json = TimeMap.loaders.jsonp;
======================================================
so can I write something like:
$(function() {
tm = TimeMap.init({
mapId: "map", // Id of map div element (required)
timelineId: "timeline", // Id of timeline div element
datasets: [
{
title: "Progressive Dataset",
type: "progressive",
options: {
// Data to be loaded in JSON locally
items: items,
type: "json",
url: "mydata.json", start:"2012-07-29",
dateMinDate:"2012-07-29",
interval: 10368000000 //15days
// function to turn date into string appropriate for service
formatDate: function(d) {
return TimeMap.util.formatDate(d, 1);
}
}
}
],
bandIntervals: "hr"
});
});
And I am not quite understand the [start] and [end] part, I look at one topic and his url is
As I mentioned above, I am almost new to javascript and php, is there a way that I can pas the data locally and progressively?
If yes, what's should be in for each item in that json file?
like:
{
{ //first data "title" : "My Item1", "start" : "2008-02-01", "point" : { "lat" : 43.6433, "lon" : 11.9875 }, "options" : { "some data": "info" },
{ //first data "title" : "My Item2", "start" : "2008-02-02", "point" : { "lat" : 41.6433, "lon" : 10.9875 }, "options" : { "some data": "info" },
... and so on
}
Thank you in advance.