Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Openlayers CQL过滤器以显示要素点,但不删除以前的?_Javascript_Jquery_Openlayers_Cql_Openlayers 6 - Fatal编程技术网

Javascript Openlayers CQL过滤器以显示要素点,但不删除以前的?

Javascript Openlayers CQL过滤器以显示要素点,但不删除以前的?,javascript,jquery,openlayers,cql,openlayers-6,Javascript,Jquery,Openlayers,Cql,Openlayers 6,我正在尝试使用cql filter IN函数从我的列表中选择要在地图上显示的所有客户 问题是,当cql过滤器获得下一个500时,我正在异步选择500个之后的500个客户,它会从映射中删除前一个500 如果cql过滤器不删除之前的500并显示下一个500,我该怎么办 let points = []; $("#selectAllCustomers").on("change", async function () { if (this.checked)

我正在尝试使用cql filter IN函数从我的列表中选择要在地图上显示的所有客户

问题是,当cql过滤器获得下一个500时,我正在异步选择500个之后的500个客户,它会从映射中删除前一个500

如果cql过滤器不删除之前的500并显示下一个500,我该怎么办

  let points = [];

 $("#selectAllCustomers").on("change", async function () {
if (this.checked) {
  dataload.classList.remove("loading-finish");
  setTimeout(async () => {
    let checkedProducts = $("input[name='productInput']:checked");
    let checkedProductsIds = [];
    checkedProducts.each(function () {
      let ids = $(this).attr("id");
      checkedProductsIds.push(ids);
    });
    let customerCheckedIds = [];

    let customercheckboxlength = $(
      "input[name='customer-input']:visible"
    ).not(":checked");

    if (customercheckboxlength.length > 0) {
      for (let i = 0; i < customercheckboxlength.length; i++) {
        let ch = customercheckboxlength[i];
        let chid = customercheckboxlength[i].id;
        ch.checked = true;
        customerCheckedIds.push(chid.slice(4));
     
}))

正如您所看到的,points是我存储客户店铺每500个id的阵列


在每个循环中,将500个id添加到点阵列中,但当点阵列具有1000或1500个id时,它不起作用,这会导致cors错误。

如果您将点作为WMS图像获取,则可以使用平铺WMS,以便每个请求的点数更少。或者将WFS与矢量图层一起使用。是的,我正在使用tilewms图层在地图上显示点。
 let point = chid.slice(4);

 points.push(parseInt(point));
        if (i == 499) {
          break;
        }
      }
      // console.log(customerCheckedIds, checkedProductsIds);
      wmsPoint.setVisible(true);
   
  

 //pointsLayer.updateParams({ CQL_FILTER: null });
      pointsLayer.updateParams({
        CQL_FILTER: `idShop in ${points}`,
      });
      if (customercheckboxlength.length > 0) {
        $(this).prop("checked", true).trigger("change");
      }
    } else {
      dataload.classList.add("loading-finish");
    }
  }, 3000);
} else {

  points = [];
  wmsPoint.setVisible(false);
  pointsLayer.updateParams({
    CQL_FILTER: `idShop in ${points}`,
  });
  $("input[name='customer-input']:visible").each(function () {
    this.checked = false;
    // $(this).trigger("change");
  });
}