Purpose
Returns the geographical area of an Object. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
Area( obj_expr, unit_name )
obj_expr is an object expression.
unit_name is a string representing the name of an area unit (e.g., "sq km").
Return Value
Float
Description
The Area() function returns the area of the geographical object specified by obj_expr.
The function returns the area measurement in the units specified by the unit_name parameter; for example, to obtain an area in acres, specify "acre" as the unit_name parameter. See Set Area Units statement for the list of available unit names.
Only regions, ellipses, rectangles, and rounded rectangles have any area. By definition, the area of a point, arc, text, line, or polyline object is zero. The Area() function returns approximate results when used on rounded rectangles. MapBasic calculates the area of a rounded rectangle as if the object were a conventional rectangle.
For the most part, MapInfo Pro performs a Cartesian or Spherical operation. Generally, a spherical operation is performed unless the coordinate system is NonEarth, in which case, a Cartesian operation is performed.
Examples
The following example shows how the Area() function can calculate the area of a single geographic object. Note that the expression tablename.obj (as in states.obj) represents the geographical object of the current row in the specified table.
Dim f_sq_miles As Float
Open Table "states"
Fetch First From states
f_sq_miles = Area(states.obj, "sq mi")
You can also use the Area() function within the SQL Select statement, as shown in the following example.
Select state, Area(obj, "sq km")
From states Into results
See Also:
ObjectLen() function, Perimeter() function, CartesianArea() function, SphericalArea() function, Set Area Units statement