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:
| Prop | When to set it |
|---|---|
version | The server only supports WMS 1.3.0 (default 1.1.1). |
srs | The server doesn't offer EPSG:3857. |
format | You want image/jpeg or another format instead of image/png. |
styles | The layer has named styles. |
extraQuery | The server needs extra parameters, such as TIME=2024-01-01 or TRANSPARENT=true. |
The same works for WMTS, TMS and XYZ services. See Layer.