Shape class

A helper class that wraps a Geometry or Feature and makes it easy to update and maintain.

Constructors

Shape(data.Geometry, string, any)

Constructs a Shape object and initializes it with the specified Geometry, ID, and properties.

Shape(Feature<data.Geometry, any>)

Constructs a Shape object and initializes it with the specified Feature.

Methods

addProperty(string, any)

Adds or updates an existing property value in the shape.

getBounds()

Gets the bounding box of the shape

getCoordinates()

Gets the coordinates of the shape.

getId()

Gets the id of the shape.

getProperties()

Gets the properties of the shape.

getType()

Returns a string indicating the type of geometry this shape contains.

isCircle()

Indicates if the contained shape is a Circle, defined by the extended GeoJSON specification supported by Azure Maps. Extended Spec

isRectangle()

Indicates if the contained shape is a Rectangle, defined by the extended GeoJSON specification supported by Azure Maps. Extended Spec

setCoordinates(Position | Position[] | Position[][] | Position[][][])

Updates the coordinates of the shape

setProperties(any)

Sets the properties on the shape. Overwrites all existing properties.

toJson()

Returns a GeoJSON feature that represents the shape.

Constructor Details

Shape(data.Geometry, string, any)

Constructs a Shape object and initializes it with the specified Geometry, ID, and properties.

new Shape(data: data.Geometry, id?: string, properties?: any)

Parameters

data
Geometry

a Geometry object

id
string

a unique id that the user assigns to the shape. If not provided, a unique id value will be assigned to it.

properties
any

User defined properties for the shape.

Shape(Feature<data.Geometry, any>)

Constructs a Shape object and initializes it with the specified Feature.

new Shape(data: Feature<data.Geometry, any>)

Parameters

data
Feature<azure-maps-control.atlas.data.Geometry, any>

a Geometry object

Method Details

addProperty(string, any)

Adds or updates an existing property value in the shape.

function addProperty(key: string, value: any)

Parameters

key
string
value
any

getBounds()

Gets the bounding box of the shape

function getBounds()

Returns

getCoordinates()

Gets the coordinates of the shape.

function getCoordinates()

Returns

Position | Position | Position[][] | Position[][][][]

getId()

Gets the id of the shape.

function getId()

Returns

string

getProperties()

Gets the properties of the shape.

function getProperties()

Returns

any

getType()

Returns a string indicating the type of geometry this shape contains.

function getType()

Returns

string

isCircle()

Indicates if the contained shape is a Circle, defined by the extended GeoJSON specification supported by Azure Maps. Extended Spec

function isCircle()

Returns

boolean

isRectangle()

Indicates if the contained shape is a Rectangle, defined by the extended GeoJSON specification supported by Azure Maps. Extended Spec

function isRectangle()

Returns

boolean

setCoordinates(Position | Position[] | Position[][] | Position[][][])

Updates the coordinates of the shape

function setCoordinates(coords: Position | Position[] | Position[][] | Position[][][])

Parameters

coords
Position | Position | Position[][] | Position[][][][]

Point: Position, LineString: Position[], Polygon: Position[][], MultiPoint: Position[], MultiLineString: Position[][], MultiPolygon: Position[][]

setProperties(any)

Sets the properties on the shape. Overwrites all existing properties.

function setProperties(properties: any)

Parameters

properties
any

toJson()

Returns a GeoJSON feature that represents the shape.

function toJson()

Returns

Feature<azure-maps-control.atlas.data.Geometry, any>