longitude()

Returns the longitude of the agent’s site for a given place, or the longitude of the agent itself.

Synopsis

longitude()
longitude(place_name)

Description

If provided a place parameter, this function returns the longitude of the agent’s site for the given place. For example, latitude(Workplace) returns the latitude of the agent’s specific Workplace site.

If no parameter was provided, this function returns the longitude of the agent itself if no argument is given. Note that the coordinates of the agent are not updated unless the agent has been moved with the move() action.

Parameters

place_name

The name of a place that the agent can visit.

Returns

With no argument, this returns the longitude of the agent itself as a floating point number.

If place_name is given, then the longitude of the agent’s site for this place is returned.

Examples

This statement returns the longitude of the agent’s school

longitude(School)

The following transition statement sends the agent to an EastCoast state if their longitude is greater than \(-90\).

if (longitude() > -90) then next(EastCoast)

Errors

It is an error if the agent is not a member of the given place.

See Also

elevation(), latitude(), move()