Purpose
Returns the geographic length of a line or polyline object. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
SphericalObjectLen( obj_expr, unit_name )
obj_expr is an object expression.
unit_name is a string representing the name of a distance unit (for example, "km").
Return Value
Float
Description
The SphericalObjectLen() 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 SphericalObjectLen() function always returns a value as calculated in a Latitude/Longitude non-projected coordinate system using spherical algorithms. A value of -1 will be returned for data that is in a NonEarth coordinate system since this data cannot be converted into a Latitude/longitude coordinate system.
The SphericalObjectLen() 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.
Example
Dim geogr_length As Float
Open Table "streets"
Fetch First From streets
geogr_length = SphericalObjectLen(streets.obj, "mi")
geogr_length now represents the length of the street segment in miles.
See Also:
CartesianObjectLen() function, SphericalObjectLen() function