I want to use the leaflet map on my react project and I would like to add a layer control where the user can switch between street view and satellite view. I am trying to use google satellite view, but it doesn't seem to work.
Here is my code
function App() {
return (
<div className="App">
<MapContainer center={[40.44695, -345.23437]} zoom={2}>
<LayersControl>
<BaseLayer checked name="OpenStreetMap">
<TileLayer
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
/>
</BaseLayer>
<BaseLayer name="Satellite View">
<TileLayer
url='https://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}'
maxZoom= {20}
/>
</BaseLayer>
</LayersControl>
</MapContainer>
</div>
);
}
export default App;
Thank you very much