ojs duckdb spatial

import { DuckDBClient as latestDuckClient } from "@kimmolinna/duckdb-latest/2" 

function convertToGeoJSON(data) {
  const features = data.map((item) => {
    const geometry = JSON.parse(item.GEOJSON);
    return {
      type: "Feature",
      geometry,
      properties: {
        iso_a3: item.iso_a3,
        area: item.area
      }
    };
  });
  return features;
}

client = {
  const con = new latestDuckClient();
  await con.query(`INSTALL spatial`);
  await con.query(`LOAD spatial`);
  await con.insertParquet("example_parquet", parquet_array);
  return con;
}

parquet_array = new Uint8Array(
  await FileAttachment("example.parquet").arrayBuffer()
)

geoparquet = client.sql`
SELECT continent, iso_a3, ST_AREA(ST_GeomFromWkb(geometry)) as area ,  ST_AsGeoJSON(ST_GeomFromWkb(geometry)) AS GEOJSON, ST_AREA(ST_GeomFromWkb(geometry)) as area
FROM example_parquet
WHERE area > 1000`


valid_geojson = convertToGeoJSON(geoparquet)
map = {
  const container = yield htl.html`<div style="height: 500px;">`;
  const map = L.map(container).setView([37.774, -122.423], 2);
  L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
    attribution:
      "© <a href=https://www.openstreetmap.org/copyright>OpenStreetMap</a> contributors"
  }).addTo(map);
  L.geoJSON(valid_geojson).addTo(map);
}