React Three Map - v1.0.9
    Preparing search index...
    • Converts BufferGeometry to a JSON-serializable format for storage.

      This is an alternative to WKT that preserves the exact triangle structure and can be stored in a JSON/JSONB column.

      Parameters

      • geometry: BufferGeometry

        The Three.js BufferGeometry to convert

      • origin: Coords

        The geographic origin for coordinate conversion

      Returns GeoTriangle[]

      An array of GeoTriangle objects that can be serialized to JSON

      Error if geometry has no position attribute

      import { bufferGeometryToGeoTriangles } from '@wendylabsinc/react-three-map/maplibre';

      const triangles = bufferGeometryToGeoTriangles(geometry, origin);
      const json = JSON.stringify(triangles);
      // Store in database JSONB column