> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Geospatial data

Store WGS84 GeoJSON in `t.geometry({ kind })` fields and measured locations
with an accuracy radius in `t.fix()` fields. Both use longitude first. An
`index` entry ending in either field serves `.near` and `.region`, partitioned
by the preceding fields.

For position history, geofences and their transitions, place an instance of
`geo({...})` from `@bijectionhq/library-geo` in the app tree.

For map settings, keyed tile providers and the export audit, place
`maps({...})` from `@bijectionhq/library-geo/maps/library`
([Map settings, keyed tiles and exports](https://docs.bijection.com/objects/geospatial/maps.md)).

See [Spatial queries](https://docs.bijection.com/objects/geospatial/queries.md) and
[Geofences](https://docs.bijection.com/objects/geospatial/geofences.md).

## Grid references

Use `@bijectionhq/library-geo/maps/geo` in guest TypeScript to format WGS84
coordinates as MGRS or USNG and convert references back to coordinates or a
polygon.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import {
  mgrsSquare,
  mgrsToPoint,
  pointToMgrs,
  pointToUsng,
} from "@bijectionhq/library-geo/maps/geo";

const mgrs = pointToMgrs([-77.0352, 38.88949]);
const usng = pointToUsng([-77.0352, 38.88949], 4);
const corner = mgrsToPoint(mgrs);
const square = mgrsSquare(usng);
```

The formatters take longitude first and write spaced references. They truncate
to 1–5 digits per axis and default to 5 digits (one metre). MGRS uses UPS at
84°N and above and south of 80°S. USNG covers only the UTM latitudes from 80°S
to just below 84°N.

`mgrsToPoint` returns the square’s southwest corner as `[longitude, latitude]`.
`mgrsSquare` returns its four corners as a closed WGS84 GeoJSON Polygon. Both
read MGRS and USNG references with 0–5 digits per axis, with or without spaces.
Use `usngToPoint` when an input must belong to USNG’s UTM grid.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.