This library is not production-ready yet. Developers should use it with caution and expect breaking changes.

Grid

Coordinate grid overlay with latitude/longitude lines and labels.

Installation

First, make sure you have the base map component installed:

npx shadcn@latest add https://www.terrae.dev/map.json

Then install the grid component:

npx shadcn@latest add https://www.terrae.dev/grid.json

Custom Styling

Customize the grid appearance with lineColor, lineOpacity, lineWidth, and label styling props. The green styling below creates a radar-like appearance.

Dense Grid

For higher zoom levels, reduce the latitudeInterval and longitudeInterval to show more detailed coordinate lines. This example uses 1-degree intervals.

Minimal Grid

Set showLabels to false for a clean grid overlay without coordinate labels. Useful as a subtle reference grid.

Properties

PropertyTypeDefaultDescription
idstring"map-grid"Unique identifier for the grid layers
latitudeIntervalnumber10Degrees between latitude lines
longitudeIntervalnumber10Degrees between longitude lines
lineColorstring#ffffffColor of the grid lines
lineOpacitynumber0.3Opacity of the grid lines (0-1)
lineWidthnumber1Width of the grid lines in pixels
showLabelsbooleantrueWhether to show coordinate labels
labelColorstring#ffffffColor of the coordinate labels
labelSizenumber10Font size of the labels in pixels
labelBackgroundstringrgba(0, 0, 0, 0.5)Background color of the labels

Use Cases

Navigation

Reference grid for maritime and aviation navigation

Scientific Mapping

Coordinate reference for geographic data analysis