Assign the survey reference
Survey import / Point 042
The record now uses the site grid. Assigning a reference preserves the entered numbers.
Two or three numeric coordinate axes with supplied units and a reference selector that preserves entered values when assigning a reference.
Survey import / Point 042
The record now uses the site grid. Assigning a reference preserves the entered numbers.
Three ways in. They share one source, so the pixels match whichever you pick.
npm install @noorddev/vlak-react
// once, next to your app's root
import "@noorddev/vlak-react/css";
import { CoordinateReferenceField } from "@noorddev/vlak-react";Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/coordinate-reference-field.
npx @noorddev/vlak-cli add coordinate-reference-field
The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.
npx shadcn add https://vlak.dev/r/coordinate-reference-field.json
The same registry item, installed by shadcn's CLI.
<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />
No React. Link vlak.css and use the markup and classes below.
import { CoordinateReferenceField } from "@noorddev/vlak-react";
<CoordinateReferenceField
label="Recorded survey point"
name="point"
axes={[{ id: "east", label: "Easting", unit: "m" }, { id: "north", label: "Northing", unit: "m" }]}
references={[{ value: "site", label: "Site grid" }, { value: "project", label: "Project grid" }]}
defaultValue={{ reference: "site", coordinates: { east: 120.5, north: 48.25 } }}
/>Numeric coordinates and an explicitly assigned reference, without implicit conversion.
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | ReactNode | ||
axesrequired | readonly CoordinateReferenceAxis[] | Two or three axes in the supplied coordinate order. Units are never inferred. | |
referencesrequired | readonly CoordinateReferenceOption[] | ||
value | CoordinateReferenceValue | ||
defaultValue | CoordinateReferenceValue | initial | |
onValueChange | (value: CoordinateReferenceValue) => void | Assigning a reference preserves every numeric value. The host owns reprojection. | |
description | ReactNode | ||
referenceLabel | string | "Coordinate reference" | |
unknownReferenceLabel | string | "Unknown reference" | |
required | boolean | ||
readOnly | boolean |
Also accepts Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, "defaultValue">.
| Keys | Does |
|---|---|
| Tab | Moves through the reference selector and coordinate inputs in supplied axis order. |
| Arrow keys, Home, End | Opens and navigates the Vlak selector. Enter or Space chooses a reference without converting numeric values; Escape closes the menu. |
| Typing | Edits numeric coordinates using the native number inputs. |
<fieldset class="rs-coordinate-reference-field"><legend class="rs-coordinate-reference-field-legend">Survey point</legend><p class="rs-coordinate-reference-field-note">Assigning a reference keeps the entered coordinates.</p><div class="rs-coordinate-reference-field-label"><span id="geo-coordinate-reference-label">Coordinate reference</span><div class="rs-select rs-select-fluid rs-coordinate-reference-field-control"><button type="button" class="rs-dropdown" role="combobox" aria-labelledby="geo-coordinate-reference-label" aria-expanded="false" aria-haspopup="listbox">Site grid</button></div></div><div class="rs-coordinate-reference-field-axes"><label class="rs-coordinate-reference-field-label">Easting (m)<input class="rs-input rs-input-full rs-coordinate-reference-field-control" name="point.coordinates.east" type="number" step="any" value="120.5" /></label><label class="rs-coordinate-reference-field-label">Northing (m)<input class="rs-input rs-input-full rs-coordinate-reference-field-control" name="point.coordinates.north" type="number" step="any" value="48.25" /></label></div></fieldset>