Layers
Ground Overlay

Ground Overlay

Sử dụng

demo.js
import { MFGroundOverlay, MFMap } from "react-map4d-map";
 
let options = {
  getUrl: function (x, y, zoom, is3dMode) {
    return `https://a.tile.opentopomap.org/${zoom}/${x}/${y}.png`;
  },
  bounds: [
    { lng: 108.22125434875488, lat: 16.059547034047146 },
    { lng: 108.23086738586424, lat: 16.075630202564316 },
  ],
  override: true,
};
const DemoGroundOverlay = (props) => {
  return (
    <>
      <div style={{ width: "100%", height: "400px" }}>
        <MFMap
          options={{
            center: { lat: 16.077279, lng: 108.222275 },
            zoom: 16,
            controls: true,
          }}
          accessKey={"d69ab3c4b70818de546a1b1bb15aeaa7"}
          version={"2.4"}
        >
          <MFGroundOverlay
            getUrl={options.getUrl}
            bounds={options.bounds}
            override={options.override}
          />
        </MFMap>
      </div>
    </>
  );
};
 
export default DemoGroundOverlay;

Kết quả

Props

NoNameisRequiredTypeDefault valueDescription
1boundstrueILatLngBounds (opens in a new tab)Vùng hiển thị của Ground overlay
2getUrltruefunctionHàm nhận vào 4 giá trị x, y, zoom, is3dModevà trả về đường dẫn đến map tile
3overridefalsebooleanfalseNếu true thì sẽ không hiển thị Map4D tile và các đối tượng cảu Map4D trong khu vực của Ground overlay
4visiblefalsebooleantrueNếu là true thì Ground overlay sẽ được hiển thị
5zIndexfalsenumber0Chỉ định thứ tự chồng nhau giữa các Ground Overlay với nhau hoặc giữa Ground Overlay với các đối tượng khác trên bản đồ
6opacityfalsenumber1Độ trong suốt của Ground overlay. Có giá trị từ 0 đến 1
7mapfaslemap4d.MapHiển thị Ground Overlay ở map nào, nếu không có sẽ hiển thị ở map gần nhất chứa Ground Overlay
8onCreatedfasle(Ground Overlay: map4d.GroundOverlay) => voidEvent sau khi tạo Ground Overlay
Last updated on December 13, 2022