Skip to navigation

Draw geo shapes

Publish points, lines, polygons, and ellipses as geo-entities on the map

A geo-entity is a shape, region, or point of interest drawn on the map, which may not physically exist. Use geo-entities to represent geographical areas of interest, such as an airfield, or a control zone for autonomous vehicles to operate in.

This page shows how to publish a polygon that defines a control area, and how to model the other shapes that Lattice supports: points, lines, and ellipses.

Before you begin

gRPC authentication

These gRPC examples authenticate with a static environment token attached as request metadata. If you are using OAuth 2.0 client credentials instead, set up the token refresh module before running the examples on this page.

Geo-entity components

In addition to the required components, a geo-entity uses the following components:

ontology.template
TemplateRequired

Set template to TEMPLATE_GEO to render the entity as a shape on the map.

geo_details
GeoDetailsRequired

Set the geo_details type, such as GEO_TYPE_GENERAL for a general shape or GEO_TYPE_CONTROL_AREA for a zone that constrains autonomous vehicles.

geo_shape
GeoShapeRequired

Define the shape itself in geo_shape: a point, line, polygon, or ellipse.

location
Location

Set the center of the shape in location when geo_shape is an ellipse. Other shapes carry their positions in geo_shape.

Publish a polygon

A polygon is the most common geo shape. It outlines an area, such as an airfield or a zone that autonomous vehicles must stay in or avoid. To publish a polygon that defines a loiter zone, do the following:

1

Define the entity

Define the entity model’s required components. Together with the geo-entity-specific components, you get the following entity object:

entity_model.json
{
"entityId": "UNIQUE_ENTITY_ID",
"description": "Polygon entity",
"isLive": true,
"createdTime": "2025-05-28T18:16:34.969Z",
"noExpiry": true,
"aliases": {
"name": "Control-Area 1"
},
"ontology": {
"template": "TEMPLATE_GEO"
},
"geoDetails": {
"type": "GEO_TYPE_CONTROL_AREA",
"controlArea": {
"type": "CONTROL_AREA_TYPE_LOITER_ZONE"
}
},
"geoShape": {
"polygon": {
"rings": [
{
"positions": [
{
"position": {
"latitudeDegrees": 33.641132,
"longitudeDegrees": -117.918669,
"altitudeAglMeters": 500
},
"heightM": 1
},
{
"position": {
"latitudeDegrees": 33.646911,
"longitudeDegrees": -117.929123,
"altitudeAglMeters": 500
},
"heightM": 1
},
{
"position": {
"latitudeDegrees": 33.635059,
"longitudeDegrees": -117.917482,
"altitudeAglMeters": 500
},
"heightM": 1
},
{
"position": {
"latitudeDegrees": 33.641132,
"longitudeDegrees": -117.918669,
"altitudeAglMeters": 500
},
"heightM": 1
}
]
}
]
}
},
"provenance": {
"integrationName": "your_integration_name",
"dataType": "test_data",
"sourceUpdateTime": "2025-05-28T18:17:34.866Z"
}
}
2

Define the shape

Take a closer look at the following components in entity_model.json. You define rings to create the polygon. Each ring must have at least four points, each represented by a position component.

The last point of a ring must be the same as its first point, which closes the shape.

"ontology": {
// Set the required template.
"template": "TEMPLATE_GEO"
}

Each point in the polygon has a minimum altitude defined as altitudeAglMeters. The heightM component sets the additional height, in meters, above altitudeAglMeters.

This example defines a three-sided polygon that represents a loiter zone. Other control area types include CONTROL_AREA_TYPE_KEEP_IN_ZONE and CONTROL_AREA_TYPE_KEEP_OUT_ZONE.

3

Publish the entity

Use the PublishEntity API method to publish the entity:

package main
import (
"context"
"fmt"
"net/http"
"os"
"time"
Lattice "github.com/anduril/lattice-sdk-go/v5"
"github.com/anduril/lattice-sdk-go/v5/client"
"github.com/anduril/lattice-sdk-go/v5/option"
"github.com/google/uuid"
)
func main() {
// Get environment variables
latticeEndpoint := os.Getenv("LATTICE_ENDPOINT")
environmentToken := os.Getenv("ENVIRONMENT_TOKEN")
// Remove sandboxesToken from the following statements if you are not developing on Sandboxes
sandboxesToken := os.Getenv("SANDBOXES_TOKEN")
// Check required environment variables
if latticeEndpoint == "" || environmentToken == "" || sandboxesToken == "" {
fmt.Println("Missing required environment variables")
os.Exit(1)
}
// Initialize headers for sandbox authorization
headers := http.Header{}
headers.Add("Anduril-Sandbox-Authorization", fmt.Sprintf("Bearer %s", sandboxesToken))
// Create the client
LatticeClient := client.NewClient(
option.WithToken(environmentToken),
option.WithBaseURL(fmt.Sprintf("https://%s", latticeEndpoint)),
option.WithHTTPHeader(headers),
)
// Generate a unique ID for the entity
entityId := uuid.New().String()
// Get creation time
creationTime := time.Now().UTC()
// Entities must be republished at least every 5 minutes to persist across Lattice service restarts
for {
latestTimestamp := time.Now().UTC()
ctx := context.Background()
// Create positions for the polygon
positions := []*Lattice.GeoPolygonPosition{
// First point
{
Position: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(33.641132),
LongitudeDegrees: Lattice.Float64(-117.918669),
AltitudeAglMeters: Lattice.Float64(500),
},
HeightM: Lattice.Float64(1),
},
// Second point
{
Position: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(33.646911),
LongitudeDegrees: Lattice.Float64(-117.929123),
AltitudeAglMeters: Lattice.Float64(500),
},
HeightM: Lattice.Float64(1),
},
// Third point
{
Position: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(33.635059),
LongitudeDegrees: Lattice.Float64(-117.917482),
AltitudeAglMeters: Lattice.Float64(500),
},
HeightM: Lattice.Float64(1),
},
// Fourth point (same as first to close the polygon)
{
Position: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(33.641132),
LongitudeDegrees: Lattice.Float64(-117.918669),
AltitudeAglMeters: Lattice.Float64(500),
},
HeightM: Lattice.Float64(1),
},
}
// Create entity to publish
entity := Lattice.Entity{
EntityID: &entityId,
Description: Lattice.String("Polygon entity"),
Aliases: &Lattice.Aliases{
Name: Lattice.String("Control-Area Loiter Zone"),
},
IsLive: Lattice.Bool(true),
CreatedTime: Lattice.Time(creationTime),
NoExpiry: Lattice.Bool(true),
Ontology: &Lattice.Ontology{
Template: Lattice.OntologyTemplateTemplateGeo.Ptr(),
},
GeoDetails: &Lattice.GeoDetails{
Type: Lattice.GeoDetailsTypeGeoTypeControlArea.Ptr(),
ControlArea: &Lattice.ControlAreaDetails{
Type: Lattice.ControlAreaDetailsTypeControlAreaTypeLoiterZone.Ptr(),
},
},
GeoShape: &Lattice.GeoShape{
Polygon: &Lattice.GeoPolygon{
Rings: []*Lattice.LinearRing{
{
Positions: positions,
},
},
},
},
Provenance: &Lattice.Provenance{
IntegrationName: Lattice.String("your_integration_name"),
DataType: Lattice.String("test_data"),
SourceUpdateTime: Lattice.Time(latestTimestamp),
},
}
// Publish the entity
_, err := LatticeClient.Entities.PublishEntity(ctx, &entity)
// Handle errors
if err != nil {
fmt.Printf("Error publishing entity: %v\n", err)
} else {
fmt.Println("Publishing geo entity")
}
// Republishing every 10 seconds
time.Sleep(10 * time.Second)
}
}

The example sets noExpiry instead of expiryTime, so the polygon persists until you delete it. For more information, see Keep shapes on the map.

Model other shapes

The other shapes use the same components as a polygon, with a different geo_shape:

A point marks a single position, such as a rally point or a landing site. Set its position in geoShape.point.position:

point.json
{
"entityId": "UNIQUE_ENTITY_ID",
"description": "Geo point",
"isLive": true,
"createdTime": "2024-12-07T00:45:15.581592Z",
"noExpiry": true,
"provenance": {
"integrationName": "your_integration_name",
"dataType": "your_data_type",
"sourceUpdateTime": "2025-04-07T00:19:47.706196Z"
},
"geoShape": {
"point": {
"position": {
"latitudeDegrees": 50.91402185768586,
"longitudeDegrees": 0.79203612077257,
"altitudeHaeMeters": 46.214997987295234,
"altitudeAglMeters": 0.5000067609670396
}
}
},
"geoDetails": {
"type": "GEO_TYPE_GENERAL"
},
"aliases": {
"name": "Point"
},
"ontology": {
"template": "TEMPLATE_GEO"
}
}

A line connects two or more positions, such as a route or a boundary. List the positions in order in geoShape.line.positions:

line.json
{
"entityId": "UNIQUE_ENTITY_ID",
"description": "Geo line",
"isLive": true,
"createdTime": "2024-12-07T01:08:39.079826Z",
"expiryTime": "2024-12-07T01:13:39.079828Z",
"provenance": {
"integrationName": "your_integration_name",
"dataType": "your_data_type",
"sourceUpdateTime": "2025-04-07T00:19:47.706196Z"
},
"geoShape": {
"line": {
"positions": [
{
"latitudeDegrees": 47.605,
"longitudeDegrees": -122.329
},
{
"latitudeDegrees": 47.61,
"longitudeDegrees": -122.33
}
]
}
},
"geoDetails": {
"type": "GEO_TYPE_GENERAL"
},
"aliases": {
"name": "Line"
},
"ontology": {
"template": "TEMPLATE_GEO"
}
}

An ellipse describes a circular or oval area around a center point, such as a keep-out radius. Set the center in location, and set the axes in meters and the orientation in degrees in geoShape.ellipse. Equal axes produce a circle:

ellipse.json
{
"entityId": "UNIQUE_ENTITY_ID",
"description": "Geo ellipse",
"isLive": true,
"createdTime": "2024-12-07T01:06:32.834952Z",
"expiryTime": "2024-12-07T01:11:32.834954Z",
"aliases": {
"name": "Ellipse"
},
"ontology": {
"template": "TEMPLATE_GEO"
},
"provenance": {
"integrationName": "your_integration_name",
"dataType": "your_data_type",
"sourceUpdateTime": "2025-04-07T00:19:47.706196Z"
},
"geoDetails": {
"type": "GEO_TYPE_CONTROL_AREA"
},
"geoShape": {
"ellipse": {
"semiMajorAxisM": 20,
"semiMinorAxisM": 20,
"orientationD": 40
}
},
"location": {
"position": {
"latitudeDegrees": 51.46,
"longitudeDegrees": -0.16
}
}
}

Keep shapes on the map

Most geo-entities describe areas that stay relevant across many operations, such as airfields and control areas. For these shapes, set noExpiry to true instead of setting an expiryTime. Use noExpiry only when the entity contains information that other tasks or integrations need beyond its immediate operational context. Don’t set both noExpiry and expiryTime. Lattice rejects an entity that sets both.

Even with noExpiry set to true, republish the entity at least every 5 minutes. If Lattice restarts and an entity hasn’t been republished within the previous 5 minutes, Lattice doesn’t restore it. The example code republishes the polygon in an indefinite loop.

To remove a shape, publish it again with isLive set to false.

What’s next?