Constimport "maplibre-gl/dist/maplibre-gl.css";
import Map from "react-map-gl/maplibre";
import { Canvas } from "@wendylabsinc/react-three-map/maplibre";
function App() {
return (
<Map
initialViewState={{
latitude: 51.5074,
longitude: -0.1278,
zoom: 15,
pitch: 60
}}
mapStyle="https://basemaps.cartocdn.com/gl/positron-gl-style/style.json"
>
<Canvas latitude={51.5074} longitude={-0.1278}>
<ambientLight intensity={0.5} />
<mesh>
<boxGeometry args={[100, 100, 100]} />
<meshStandardMaterial color="hotpink" />
</mesh>
</Canvas>
</Map>
);
}
A React Three Fiber canvas that renders inside a MapLibre map.
This component bridges
@react-three/fiberwithreact-map-gl(MapLibre variant), allowing you to render Three.js scenes at geographic coordinates on the map.Must be used as a child of a
Mapcomponent fromreact-map-gl/maplibre.