Map zones

Map zones are saved shapes (polygons, lines, etc.) for the locations map, stored as GeoJSON (type + coordinates). They can optionally link to a location (for example a building footprint).

Overview

Reads use v_map_zones. Writes use rpc_create_map_zone, rpc_update_map_zone, and rpc_delete_map_zone. Set tenant context before list and getById; write RPCs take an explicit tenantId.

List zones

client.mapZones.list()

const zones = await client.mapZones.list()
// Returns MapZoneRow[] — id, tenant_id, name, geometry, location_id, created_at, updated_at

Get by ID

client.mapZones.getById(id)

const zone = await client.mapZones.getById('uuid-of-zone')
// Returns MapZoneRow | null

Create zone

geometry must be GeoJSON with type and coordinates (RFC 7946). locationId is optional; if set, it must reference a location in the same tenant.

client.mapZones.create(params)

const zoneId = await client.mapZones.create({
  tenantId: 'uuid-of-tenant',
  name: 'North yard',
  geometry: {
    type: 'Polygon',
    coordinates: [
      [
        [-122.4, 37.8],
        [-122.39, 37.8],
        [-122.39, 37.81],
        [-122.4, 37.81],
        [-122.4, 37.8],
      ],
    ],
  },
  locationId: 'uuid-of-location-or-null',
})
// Returns string (UUID)
  • Name
    tenantId
    Description

    Required. Tenant UUID.

  • Name
    name
    Description

    Required. 1–255 characters.

  • Name
    geometry
    Description

    Required. GeoJSON geometry object (type + coordinates).

  • Name
    locationId
    Description

    Optional. Location UUID in the same tenant.

Update zone

Only tenantId and zoneId are required. Pass name, geometry, and/or locationId only for fields you want to change (omitted fields stay as they are).

client.mapZones.update(params)

await client.mapZones.update({
  tenantId: 'uuid-of-tenant',
  zoneId: 'uuid-of-zone',
  name: 'North yard (revised)',
})

Delete zone

client.mapZones.delete(tenantId, zoneId)

await client.mapZones.delete('uuid-of-tenant', 'uuid-of-zone')

Access and limits

Authenticated tenant members may create, update, and delete zones for their tenant. Rate limits (rolling, per user per tenant): 30/minute for create, update, and delete.

Was this page helpful?