Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jacobsamo/buzztrip/llms.txt

Use this file to discover all available pages before exploring further.

Paths are vector overlays drawn directly on the map surface. BuzzTrip supports five path types — line, circle, rectangle, polygon, and text — each of which encodes its geometry as one or more Position values. A Position is a tuple of two or three numbers: [longitude, latitude] or [longitude, latitude, altitude]. Depending on the shape, the points field holds a single Position (e.g. the center of a circle), an array of Position[] (e.g. the vertices of a line or polygon ring), or a nested Position[][] (e.g. a polygon with holes). Measurements (area, perimeter, radius, etc.) and visual styles (stroke color, fill, opacity) are stored alongside the geometry, allowing the client to render and label shapes accurately without recomputing values. All operations require authentication via the authedQuery / authedMutation wrappers.

Schema Reference

pathType

points (Position schema)

// A single 2D or 3D coordinate
type Position = [number, number] | [number, number, number];

// Depending on the shape:
type Points =
  | Position      // single point — used for circles, text
  | Position[]    // array of points — used for lines
  | Position[][]  // nested array — used for polygons (ring + optional holes)

measurements

Each path type stores different measurement fields. All measurement objects include perimeter at minimum.

styles


getPathsForMap

Returns all paths belonging to a map, validated against the full pathsSchema. API path: api.maps.paths.getPathsForMap
Type: authedQuery — authentication required
mapId
Id<'maps'>
required
The map whose paths should be returned.
Returns: Path[] | null
import { useQuery } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";

const mapId = "abc123" as Id<"maps">;

const paths = useQuery(api.maps.paths.getPathsForMap, { mapId });

paths?.forEach((p) => {
  console.log(p.pathType, p.title, p.points);
});

createPath

Inserts a new path onto a map. The createdBy field is automatically injected from the authenticated user context — you must not include it in your arguments. API path: api.maps.paths.createPath
Type: authedMutation — authentication required
mapId
Id<'maps'>
required
The map to draw the path on.
pathType
"text" | "circle" | "rectangle" | "polygon" | "line"
required
The type of shape to create.
title
string
required
Display label for the path.
points
Position | Position[] | Position[][]
required
Geometry data. A single Position for a circle or text annotation; Position[] for a line; Position[][] for a polygon.
note
string
Optional note attached to this path.
measurements
Measurements
Optional measurement data. Provide the appropriate shape for the pathType (see schema reference above).
styles
PathStyle
Optional visual styles.
updatedAt
string
Optional ISO 8601 datetime string.
Returns: Id<'paths'> — the document ID of the newly created path.
import { useMutation } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";

const createPath = useMutation(api.maps.paths.createPath);

// Draw a walking route between two points
const pathId = await createPath({
  mapId: "abc123" as Id<"maps">,
  pathType: "line",
  title: "Walk to Asakusa",
  points: [
    [139.7016, 35.6586],
    [139.7967, 35.7148],
  ],
  measurements: {
    perimeter: 12400,
  },
  styles: {
    strokeColor: "#3a86ff",
    strokeWidth: 3,
    strokeOpacity: 0.85,
  },
});

console.log("Created path:", pathId);

editPath

Replaces the fields of an existing path and stamps updatedAt with the current ISO datetime. The full pathsEditSchema is accepted (minus system fields _id and _creationTime). API path: api.maps.paths.editPath
Type: authedMutation — authentication required
pathId
Id<'paths'>
required
The path to update.
path
pathsEditSchema
required
The updated path data. All fields from pathsEditSchema are accepted except _id and _creationTime.
Returns: Id<'paths'> — the ID of the updated path.
import { useMutation } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";

const editPath = useMutation(api.maps.paths.editPath);

const pathId = await editPath({
  pathId: "path_xyz" as Id<"paths">,
  path: {
    mapId: "abc123" as Id<"maps">,
    pathType: "line",
    title: "Walk to Asakusa (updated)",
    points: [
      [139.7016, 35.6586],
      [139.7500, 35.6900],
      [139.7967, 35.7148],
    ],
    measurements: {
      perimeter: 13800,
    },
    styles: {
      strokeColor: "#e85d04",
      strokeWidth: 4,
    },
  },
});

console.log("Updated path:", pathId);

deletePath

Permanently deletes a path document. API path: api.maps.paths.deletePath
Type: authedMutation — authentication required
pathId
Id<'paths'>
required
The document ID of the path to delete.
Returns: Id<'paths'> — the ID of the deleted path.
import { useMutation } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";

const deletePath = useMutation(api.maps.paths.deletePath);

const deletedId = await deletePath({ pathId: "path_xyz" as Id<"paths"> });

console.log("Deleted path:", deletedId);

Build docs developers (and LLMs) love