Javascript Open Layers 3是否从特定时间日期获取geojson数据?
我试图找出按日期从geojson文件中获取数据的最佳方法。每个要素点都有一个时间参数,我需要在地图中显示与特定日期和时间匹配的点 我还有一个日期选择选择器,它将根据所选日期显示地图中的点 有什么想法吗?这就是我对代码流程的设想:Javascript Open Layers 3是否从特定时间日期获取geojson数据?,javascript,jquery,datepicker,openlayers-3,Javascript,Jquery,Datepicker,Openlayers 3,我试图找出按日期从geojson文件中获取数据的最佳方法。每个要素点都有一个时间参数,我需要在地图中显示与特定日期和时间匹配的点 我还有一个日期选择选择器,它将根据所选日期显示地图中的点 有什么想法吗?这就是我对代码流程的设想: // 1. Geojson data: { 'type':'FeatureCollection', 'crs': {...}, 'features': { 'type': 'Feature', 'geometry': {...}, 'pr
// 1. Geojson data:
{ 'type':'FeatureCollection',
'crs': {...},
'features': {
'type': 'Feature',
'geometry': {...},
'properties': {
'reportStartTime': '2015-12-04T00:55:00Z',
'id': '3421',
...
}
}
}
// 2. Get current date
var now = new Date(new Date());
var hour = now.getHours();
var nextHour = hour + 1; // I need to know when the next hour starts
var hourDiff = // I need to get the hours from 00:00 to 00:59min
// 3. Show points in the map that match the current date
function fetchData(feature, timeSelected) {
var reportStartTime = feature.get('reportStartTime');
if(reportStartTime == timeSelected){
return // Show the map points
}
}
fetchData(feature, hourDiff);
// 4. Filter date picker (using bootstrap date picker)
var newTimeSelected = $('#datetimepicker1').find('input').val(); // i.e returns 12/10/2015 11:57 AM
// 5. Change the map points that match the date selected from the date picker
$('button').submit(function() {
fetchData(feature, newTimeSelected);
});
我认为您必须显示一段geojson数据和这个日期选择器的输出格式。您必须执行一些日期操作。对于JavaScript来说,这不是一项容易的任务,您介意使用像这样的助手库吗?或者看一看,我认为您必须显示一段geojson数据和这个日期选择器的输出格式。您必须执行一些日期操作。对于JavaScript来说,这不是一项容易的任务,您介意使用像这样的助手库吗?或者看看