realtime.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. function loadRealtimePOI(config, markerClick, initMethod) {
  2. console.log(config)
  3. var host = window.EASYMAP_CONFIG['poihost'];
  4. //var layerpoi = new L.tileLayer.wmts( 3414801
  5. var datatime = new Date().getTime();
  6. var endTimeSecond = Math.ceil(datatime / 100000)*100;
  7. var startTimeSecond = Math.ceil(datatime / 100000)*100 - (config.time != undefined ? config.time : 1800);
  8. //console.log(endTimeSecond);
  9. //console.log(startTimeSecond);
  10. let _config = Object.assign({
  11. size: 1000,
  12. //source: "attributes._targetID,pcolor,location,layerGroupName,lon,lat",
  13. layer: "zt_cbzt_zc_gj",
  14. realtimeLayer: 'zt_cbzt_zc_gj',
  15. gjLayer: 'zt_cbzt_zc_gj',
  16. //yjLayer: 'xs_cb_cbyj',
  17. style: "default",
  18. tilematrixSet: "default",
  19. format: "realtime_color",//"marker ",//json ,color , hot :热力图,aggs:聚合查询
  20. //自定义条件查询,需要对ES查询有所了解,字段前必须加上attributes.
  21. customsQuery: "{\"must\":[{\"range\":{\"attributes.collecTime\":{\"lte\":" + endTimeSecond + ",\"gt\":" + startTimeSecond + "}}}]}",
  22. //矩形选空间查询
  23. //bbox:"BBOX(109.6875,111.12671,20.17639,19.44031)",
  24. //BBOX:"BBOX(minx,maxx,maxy,miny)
  25. //多边形选空间查询
  26. //polygon:"[{lat: 20.05966, lng: 110.16678},{lat: 20.05486, lng: 110.42702},{lat: 19.88731, lng: 110.42976},{lat: 19.89899, lng: 110.10841}]",
  27. //LatLng(20.05966, 110.16678),LatLng(20.05486, 110.42702),LatLng(19.88731, 110.42976),LatLng(19.89899, 110.10841)
  28. //圈选空间查询
  29. //point:"19.52109999980007,109.59813000000008",
  30. //radius:"5000m",
  31. //关键字查询
  32. //keyworks:"海口"
  33. }, config)
  34. var layerpoi = new initMethod(
  35. host + '/poiwmts/color/getTile',
  36. host + '/poiwmts/json/getTile',
  37. _config,
  38. markerClick ,
  39. );
  40. return layerpoi
  41. }