Purpose
Returns the geographic length of a line or polyline object. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
ObjectLen( expr, unit_name )
expr is an object expression.
unit_name is a string representing the name of a distance unit (for example, "mi" for miles).
Return Value
Float
Description
The ObjectLen() function returns the length of an object expression. Note that only line and polyline objects have length values greater than zero; to measure the circumference of a rectangle, ellipse, or region, use the Perimeter() function.
The ObjectLen() function returns a length measurement in the units specified by the unit_name parameter; for example, to obtain a length in miles, specify "mi" as the unit_name parameter. See Set Distance Units statement for the list of valid unit names.
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.
Example
Dim geogr_length As Float
Open Table "streets"
Fetch First From streets
geogr_length = ObjectLen(streets.obj, "mi")
geogr_lengthnow represents the length of the street segment in miles.
See Also:
Distance() function, Perimeter() function, Set Distance Units statement