import { useEffect, useMemo, useState } from "react";
import { ImageryLayer, useCesium } from "resium";
import { WebMapServiceImageryProvider } from "cesium";

const url = "http://analysis.tpdc.ac.cn/gs/geoserver/phitrellis/wms";
const name = "phitrellis:4_3_t2m_era_1024";

function LandImageLayer() {
  const { viewer } = useCesium();

  const tempProvider = useMemo(
    () =>
      new WebMapServiceImageryProvider({
        url: url,
        layers: name,
        parameters: {
          service: "WMS",
          format: "image/png",
          transparent: true,
        },
      }),
    [name, url]
  );
  return (
    <ImageryLayer
      key={`ImageryLayer-${name}`}
      imageryProvider={tempProvider}
      show={true}
    />
  );
}

export default LandImageLayer;
