I am using following js script which loads custom geojson file depending on time parameter passed(date format):
_getDataForTime: function(time) {
if (!this._map) {
return;
}
var jsd ={}
var d = new Date(time);
url0="https://raw.githubusercontent.com/tekija/LCd/master/"
var url = url0+ d.format("yyyy-mm-dd'T'HH", true) + '.geojson';
var callback = function(status, data) {
console.log(status);
jsd=data;
console.log(data);
// data
if (status == 'ok'){
this._currentTimeData = data;
} else{
this._currentTimeData = [];
}
this._currentLoadedTime = time;
if (this._timeDimension && time == this._timeDimension.getCurrentTime() && !this._timeDimension.isLoading()) {
this._update();
}
this.fire('timeload', {
time: time
});
};
$.getJSON(url, callback.bind(this, 'ok')).fail(callback.bind(this, 'error'));
}
Here is example of geojson file used - can be used instead of url
variable.
I can log data to console with console.log(data)
, but I cant access individual fields in JSON i.e. t2m
and coordinates
.
How can I do this?
I tried referencing with data.features.t2m
but no success.