123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- //var host = 'http://localhost:9082';
- function loadPOI(config, markerClick, otherParam) {
- var poihost = window.EASYMAP_CONFIG['poihost'];
- let timeStart = otherParam.timeStart
- let timeEnd = otherParam.timeEnd
- let timeRange = (timeStart && timeEnd) ? getTimeRang(otherParam.timeField, 'gte', timeStart, 'lt', timeEnd) : '';
- let stateTerms = otherParam.state ? getTerms("state", [otherParam.state]) : '';
- let code = otherParam.areaCode ? getTerms("code", [otherParam.areaCode]) : '';
- let xiansuoLabs = otherParam.xiansuoLabs ? getTerms("xiansuoLabs", [otherParam.xiansuoLabs]) : '';
- let customsQuery = getCustomsQuery([timeRange, stateTerms, xiansuoLabs]);
- // let customsQuery = getCustomsQuery([timeRange, stateTerms, code]);
- // let customsQuery = getCustomsQuery([timeRange, stateTerms]);
- //var layerpoi = new L.tileLayer.wmts(
- // console.log(customsQuery)
- var obj = {
- size: 1000,
- // from:1,页面数或者条数
- layer: '_all',
- style: "default",
- tilematrixSet: "default",
- format: "marker",//"marker ",//json , hot :热力图,aggs:聚合查询
- //source: "pcolor,location,layerGroupName,lon,lat",
- //自定义条件查询,需要对ES查询有所了解,字段前必须加上attributes.
- //customsQuery:"{\"must\":[{\"terms\":{\"attributes.tow_pac\":[\"460105002\",\"460106100\",\"儋州\"]}}]}",
- //"{\"must\":[{\"term\":{\"attributes.tow_pac\":\"460105002\"}},{\"terms\":{\"attributes.city\":[\"海口\",\"三亚\",\"儋州\"]}}],\"should\":[{\"range\":{\"attributes.lon\":{\"lte\":\"109.6875\",\"gt\":\"109.7875\"}}}],\"must_not\":[],\"filter\":[]}"
- //矩形选空间查询
- //bbox:"BBOX(109.6875,111.12671,20.17639,19.44031)",
- //BBOX:"BBOX(minx,maxx,maxy,miny)
- //多边形选空间查询
- //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}]",
- //LatLng(20.05966, 110.16678),LatLng(20.05486, 110.42702),LatLng(19.88731, 110.42976),LatLng(19.89899, 110.10841)
- //圈选空间查询
- //point:"19.52109999980007,109.59813000000008",
- //radius:"5000m",
- //关键字查询
- //keyworks:"海口"
- }
- console.log(customsQuery)
- if (customsQuery) {
- obj.customsQuery = customsQuery
- }
- // if (otherParam.areaCode) {
- // obj.areaCode = otherParam.areaCode
- // }
- obj = Object.assign(obj, config)
- var layerpoi = new L.tileLayer.wmts.poi(
- poihost + '/poiwmts/aggMarker/getTile',
- poihost + '/poiwmts/aggjson/getTile',
- obj,
- markerClick
- );
- return layerpoi
- // map.addLayer(layerpoi);
- /*var layerhotpoi = new L.tileLayer.wmts(
- host+'/poiwmts/marker/getTile',
- {
- size:10000,
- layer: "_all",
- style: "default",
- tilematrixSet: "default",
- format: "marker",//"marker ",//json , hot :热力图,aggs:聚合查询
- //自定义条件查询,需要对ES查询有所了解,字段前必须加上attributes.
- //customsQuery:"{\"must\":[{\"terms\":{\"attributes.tow_pac\":[\"460105002\",\"460106100\",\"儋州\"]}}]}",
- //"{\"must\":[{\"term\":{\"attributes.tow_pac\":\"460105002\"}},{\"terms\":{\"attributes.city\":[\"海口\",\"三亚\",\"儋州\"]}}],\"should\":[{\"range\":{\"attributes.lon\":{\"lte\":\"109.6875\",\"gt\":\"109.7875\"}}}],\"must_not\":[],\"filter\":[]}"
- //矩形选空间查询
- //bbox:"BBOX(109.6875,111.12671,20.17639,19.44031)",
- //BBOX:"BBOX(minx,maxx,maxy,miny)
- //多边形选空间查询
- //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}]",
- //LatLng(20.05966, 110.16678),LatLng(20.05486, 110.42702),LatLng(19.88731, 110.42976),LatLng(19.89899, 110.10841)
- //圈选空间查询
- //point:"19.52109999980007,109.59813000000008",
- //radius:"5000m",
- //关键字查询
- //keyworks:"海口"
- });*/
- //this.map.addLayer(layerhotpoi);
- /*var layerjsonpoi = new L.tileLayer.wmts(
- host+'/poiwmts/json/getTile',
- {
- size:10000,
- layer: "_all",
- style: "default",
- tilematrixSet: "default",
- format: "json",//"marker ",//json , hot :热力图,aggs:聚合查询
- //自定义条件查询,需要对ES查询有所了解,字段前必须加上attributes.
- //customsQuery:"{\"must\":[{\"terms\":{\"attributes.tow_pac\":[\"460105002\",\"460106100\",\"儋州\"]}}]}",
- //"{\"must\":[{\"term\":{\"attributes.tow_pac\":\"460105002\"}},{\"terms\":{\"attributes.city\":[\"海口\",\"三亚\",\"儋州\"]}}],\"should\":[{\"range\":{\"attributes.lon\":{\"lte\":\"109.6875\",\"gt\":\"109.7875\"}}}],\"must_not\":[],\"filter\":[]}"
- //矩形选空间查询
- //bbox:"BBOX(109.6875,111.12671,20.17639,19.44031)",
- //BBOX:"BBOX(minx,maxx,maxy,miny)
- //多边形选空间查询
- //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}]",
- //LatLng(20.05966, 110.16678),LatLng(20.05486, 110.42702),LatLng(19.88731, 110.42976),LatLng(19.89899, 110.10841)
- //圈选空间查询
- //point:"19.52109999980007,109.59813000000008",
- //radius:"5000m",
- //关键字查询
- //keyworks:"海口"
- });*/
- //this.map.addLayer(layerjsonpoi);
- }
- function getCustomsQuery(arr) {
- // console.log(arr)
- let customsQuery = "{\"must\":[";
- for (var i = 0; i < arr.length; i++) {
- if (!arr[i]) {
- arr.splice(i, 1)
- i--
- }
- }
- // console.log(arr)
- customsQuery += arr.join(',')
- customsQuery += "]}";
- return arr.length ? customsQuery : '';
- }
- /***
- * field : 字段名称 :updateTime
- * opStart : 操作符: lte , lt , gt , gte
- * startTime: 开始时间:20201016151700
- * opEnd : 操作符: lte , lt , gt , gte
- * endTime:结束时间:20201017151700
- * */
- function getTimeRang(field, opStart, startTime, opEnd, endTime) {
- return "{\"range\":{\"attributes." + field + "\":{\"" + opStart + "\":\"" + startTime + "\",\"" + opEnd + "\":\"" + endTime + "\"}}}";
- }
- /***
- * field : 字段名称 :updateTime
- * opStart : 操作符: lte , lt , gt , gte
- * startTime: 开始时间:20201016151700
- * opEnd : 操作符: lte , lt , gt , gte
- * endTime:结束时间:20201017151700
- * */
- function getTerms(field, values) {
- let val = '';
- if (values.length) {
- val = values.join(',')
- }
- return "{\"terms\":{\"attributes." + field + "\":[" + val + "]}}";
- }
- function loadPoiHot(config) {
- console.log(123123)
- var poihost = window.EASYMAP_CONFIG['poihost'];
- // var layerpoi = new L.tileLayer.wmts(
- var layerpoi = new L.tileLayer.wmts.poi(
- poihost + '/poiwmts/hot/getTile', null,
- {
- size: 1000,
- layer: config.type,
- style: "default",
- tilematrixSet: "default",
- format: "hot",//"marker ",//json , hot :热力图,aggs:聚合查询
- source: "pcolor,location,layerGroupName,lon,lat",
- //自定义条件查询,需要对ES查询有所了解,字段前必须加上attributes.
- // customsQuery: "{\"nested\" : {\"path\" : \"attributes\",\"query\" : {\"range\" : {\"attributes.createDate\": {\"gte\": \"" + config.timeStart + "\",\"lte\": \"" + config.timeEnd + "\"}}}}}"
- customsQuery: "{\"must\":[{\"range\":{\"attributes.collecTime\":{\"lte\":\"" + config.timeEnd + "\",\"gte\":\"" + config.timeStart + "\"}}}]}"
- // customsQuery: "{\"must\":[{\"range\":{\"attributes.collectime\":{\"lte\":" + config.timeEnd + ",\"gt\":" + config.timeStart + "}}}]}",
- // customsQuery: "{\"must\":[{\"terms\":{\"attributes.createDate\":[\"1605579383\"]}}]}",
- //"{\"must\":[{\"term\":{\"attributes.tow_pac\":\"460105002\"}},{\"terms\":{\"attributes.city\":[\"海口\",\"三亚\",\"儋州\"]}}],\"should\":[{\"range\":{\"attributes.lon\":{\"lte\":\"109.6875\",\"gt\":\"109.7875\"}}}],\"must_not\":[],\"filter\":[]}"
- //矩形选空间查询
- //bbox:"BBOX(109.6875,111.12671,20.17639,19.44031)",
- //BBOX:"BBOX(minx,maxx,maxy,miny)
- //多边形选空间查询
- //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}]",
- //LatLng(20.05966, 110.16678),LatLng(20.05486, 110.42702),LatLng(19.88731, 110.42976),LatLng(19.89899, 110.10841)
- //圈选空间查询
- //point:"19.52109999980007,109.59813000000008",
- //radius:"5000m",
- //关键字查询
- //keyworks:"海口"
- });
- return layerpoi
- // map.addLayer(layerpoi);
- /*var layerhotpoi = new L.tileLayer.wmts(
- host+'/poiwmts/marker/getTile',
- {
- size:1000,
- layer: "_all",
- style: "default",
- tilematrixSet: "default",
- format: "marker",//"marker ",//json , hot :热力图,aggs:聚合查询
- //自定义条件查询,需要对ES查询有所了解,字段前必须加上attributes.
- //customsQuery:"{\"must\":[{\"terms\":{\"attributes.tow_pac\":[\"460105002\",\"460106100\",\"儋州\"]}}]}",
- //"{\"must\":[{\"term\":{\"attributes.tow_pac\":\"460105002\"}},{\"terms\":{\"attributes.city\":[\"海口\",\"三亚\",\"儋州\"]}}],\"should\":[{\"range\":{\"attributes.lon\":{\"lte\":\"109.6875\",\"gt\":\"109.7875\"}}}],\"must_not\":[],\"filter\":[]}"
- //矩形选空间查询
- //bbox:"BBOX(109.6875,111.12671,20.17639,19.44031)",
- //BBOX:"BBOX(minx,maxx,maxy,miny)
- //多边形选空间查询
- //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}]",
- //LatLng(20.05966, 110.16678),LatLng(20.05486, 110.42702),LatLng(19.88731, 110.42976),LatLng(19.89899, 110.10841)
- //圈选空间查询
- //point:"19.52109999980007,109.59813000000008",
- //radius:"5000m",
- //关键字查询
- //keyworks:"海口"
- });*/
- //this.map.addLayer(layerhotpoi);
- /*var layerjsonpoi = new L.tileLayer.wmts(
- host+'/poiwmts/json/getTile',
- {
- size:1000,
- layer: "_all",
- style: "default",
- tilematrixSet: "default",
- format: "json",//"marker ",//json , hot :热力图,aggs:聚合查询
- //自定义条件查询,需要对ES查询有所了解,字段前必须加上attributes.
- //customsQuery:"{\"must\":[{\"terms\":{\"attributes.tow_pac\":[\"460105002\",\"460106100\",\"儋州\"]}}]}",
- //"{\"must\":[{\"term\":{\"attributes.tow_pac\":\"460105002\"}},{\"terms\":{\"attributes.city\":[\"海口\",\"三亚\",\"儋州\"]}}],\"should\":[{\"range\":{\"attributes.lon\":{\"lte\":\"109.6875\",\"gt\":\"109.7875\"}}}],\"must_not\":[],\"filter\":[]}"
- //矩形选空间查询
- //bbox:"BBOX(109.6875,111.12671,20.17639,19.44031)",
- //BBOX:"BBOX(minx,maxx,maxy,miny)
- //多边形选空间查询
- //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}]",
- //LatLng(20.05966, 110.16678),LatLng(20.05486, 110.42702),LatLng(19.88731, 110.42976),LatLng(19.89899, 110.10841)
- //圈选空间查询
- //point:"19.52109999980007,109.59813000000008",
- //radius:"5000m",
- //关键字查询
- //keyworks:"海口"
- });*/
- //this.map.addLayer(layerjsonpoi);
- }
|