CartesianArea() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns the area as calculated in a flat, projected coordinate system using a Cartesian algorithm. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

CartesianArea( 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 CartesianArea() function returns the Cartesian 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 the Set Area Units statement for the list of available unit names.

The CartesianArea() function will always return the area using a cartesian algorithm. A value of -1 will be returned for data that is in a Latitude/Longitude since the data is not projected.

Only regions, ellipses, rectangles, and rounded rectangles have any area. By definition, the CartesianArea() of a point, arc, text, line, or polyline object is zero. The CartesianArea() 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.

Examples

The following example shows how the CartesianArea() 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 "counties" 
Fetch First From counties
f_sq_miles = CartesianArea(counties.obj, "sq mi")

You can also use the CartesianArea() function within the Select statement, as shown in the following example.

Select lakes, CartesianArea(obj, "sq km") 
	From lakes Into results 

See Also:

Area() function, SphericalArea() function