CartesianObjectLen() 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 geographic length of a line or polyline object. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

CartesianObjectLen( obj_expr, unit_name )

obj_expr is an object expression.

unit_name is a string representing the name of a distance unit (e.g., "km").

Return Value

Float

Description

The CartesianObjectLen() 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 CartesianObjectLen() function will always return a value using a cartesian algorithm. A value of -1 will be returned for data that is in a Latitude/Longitude coordinate system, since Latitude/Longitude data is not projected and not cartesian.

The CartesianObjectLen() 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 the 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 = CartesianObjectLen(streets.obj, "mi")
' geogr_length now represents the length of the 
' street segment, in miles 

See Also:

SphericalObjectLen() function, CartesianObjectLen() function, ObjectLen() function