gistda-sphere-react

Custom WMS layer

Show imagery from any Web Map Service on top of the base map

import { Layer, SphereMap, SphereProvider } from "gistda-sphere-react";

function App() {
  return (
    <SphereProvider apiKey="YOUR_API_KEY">
      <SphereMap center={{ lon: 101, lat: 13 }} zoom={5} style={{ height: 500 }}>
        <Layer
          name="bluemarble_terrain"
          type="WMS"
          url="https://ms.longdo.com/mapproxy/service"
          opacity={0.7}
          zoomRange={{ min: 1, max: 12 }}
        />
      </SphereMap>
    </SphereProvider>
  );
}

name is the WMS layer name (the LAYERS parameter). For other servers, also check:

PropWhen to set it
versionThe server only supports WMS 1.3.0 (default 1.1.1).
srsThe server doesn't offer EPSG:3857.
formatYou want image/jpeg or another format instead of image/png.
stylesThe layer has named styles.
extraQueryThe server needs extra parameters, such as TIME=2024-01-01 or TRANSPARENT=true.

The same works for WMTS, TMS and XYZ services. See Layer.