Geo map
v0.64.0, changelogBetaAn outdoor map in latitude and longitude, in SVG with no map library: your own raster tiles or a grid, robots with GPS fix, geofences, routes, pan and zoom, a goal, and GeoMapList as text.
API reference
Generated from the types. Every part also takes className.
GeoMap
- labelrequired
stringNames the map for screen readers: "Map of the orchard".- robots
GeoMapRobot[] = []- fences
GeoMapFence[] = []- route
GeoPoint[] = []A route, numbered from its first waypoint: dashed grey, or the in-progress blue withrouteActive.- routeActive
booleanThe route is the one a robot is driving now: its line turns the in-progress blue.- tileUrl
string | ((tile: GeoMapTile) => string)Raster tiles: a URL template with {z}, {x} and {y} (https://tiles.example.com/), or a function from a tile to its URL (signed URLs, a local cache). Bring your own tile server: OpenStreetMap's public servers forbid heavy use and apps that do not identify themselves. Without it the map draws a coordinate grid, which needs no network.{z}/ {x}/ {y}.png - attribution
ReactNodeWho the tiles are from, shown on the map as their licence asks: "© OpenStreetMap contributors".- tileSize
number = 256Tile width in pixels: 256 (the default) or 512.- tileMaxZoom
number = 19The deepest zoom level the tile server has; past it, its tiles are drawn larger. Default 19.- center
{ lat: number; lon: number }The first view, before anyone pans or zooms. Without it the map fits the robots, the fences and the route.- zoom
number- minZoom
number = 2Zoom limits of the view. Defaults 2 and 22.- maxZoom
number = 22- selectedId
string | nullThe selected robot, controlled; null for none. Without it the map keeps its own selection.- onSelect
(id: string | null, robot?: GeoMapRobot) => voidCalled with the robot clicked, or null when the background is clicked or Esc pressed.- loading
booleanBones in the frame while the map loads.- error
ReactNodeThe map could not be loaded: says so in the frame (truefor the default words, or your own message).- onRetry
() => void- fill
booleanFill the parent's height (a full-screen map) instead of a 16:10 frame.- mode
"view" | "goal" = "view"goal: a click (or Enter at the keyboard crosshair) places a goal, a drag points it, and the goal is sent on confirm.- goal
{ lat: number; lon: number; heading?: number } | nullThe goal to show, controlled.- onGoal
(goal: GeoMapGoal) => voidGoal mode: the goal, once confirmed (Send, or Enter).headingis left out when nobody pointed it.- confirmGoal
boolean = trueAsk before sending a goal placed with the pointer (default true). With false a release sends it, as robot-map does.- announceEveryMs
number = 3000Robots' fix changes are said at most this often, gathered into one sentence. Default 3000 ms.- locale
stringFormats coordinates, accuracy and distances. Pass the app's locale beside its labels.- labels
Partial<GeoMapLabels>
GeoMapList
Also takes every prop of Pick<GeoMapProps, "label" | "robots" | "fences" | "selectedId" | "onSelect" | "loading" | "error" | "onRetry" | "locale" | "labels" | "className">.
- labelrequired
stringNames the map for screen readers: "Map of the orchard".- onSelect
(id: string | null, robot?: GeoMapRobot) => voidCalled with the robot clicked, or null when the background is clicked or Esc pressed.- loading
booleanBones in the frame while the map loads.- error
ReactNodeThe map could not be loaded: says so in the frame (truefor the default words, or your own message).- labels
Partial<GeoMapLabels>- locale
stringFormats coordinates, accuracy and distances. Pass the app's locale beside its labels.- robots
GeoMapRobot[] = []- fences
GeoMapFence[] = []- selectedId
string | nullThe selected robot, controlled; null for none. Without it the map keeps its own selection.- onRetry
() => void