The WKT string in POLYHEDRALSURFACE Z format
Conversion options including the geographic origin
A Three.js BufferGeometry representing the polyhedral surface
The function expects WKT in the format:
POLYHEDRALSURFACE Z (
((lng1 lat1 alt1, lng2 lat2 alt2, lng3 lat3 alt3, lng1 lat1 alt1)),
...
)
import { wktToBufferGeometry } from '@wendylabsinc/react-three-map/maplibre';
const wkt = 'POLYHEDRALSURFACE Z (((-0.1 51.5 0, -0.1 51.6 0, -0.2 51.5 0, -0.1 51.5 0)))';
const origin = { latitude: 51.5074, longitude: -0.1278, altitude: 0 };
const geometry = wktToBufferGeometry(wkt, { origin });
// Use in a mesh:
// <mesh geometry={geometry}>
// <meshStandardMaterial />
// </mesh>
bufferGeometryToWKT for the inverse operation
Parses a PostGIS POLYHEDRALSURFACE Z WKT string and converts it to a BufferGeometry.