CartesianDirection / SphericalDirection - 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

Calculates the mathematical direction of a linear object; corresponds to choosing Spatial > Edit > Calculate > Calculate Direction. This function requires the MapCAD Tool and can be executed via the Exec() command. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

Exec ("MapCAD.mbx","CartesianDirection", LineObj)

Exec ("MapCAD.mbx","SphericalDirection", LineObj)

Return Value

Float. If the function failed the return value is 999.

Description

Use the CartesianDirection and SphericalDirection functions to calculate the mathematical direction angle of a linear object in degrees. This angle is defined by the slope of the line, so the direction of the line is taken into account. A directional angle is determined counterclockwise with respect to the x-axis. Only line objects and polyline objects with two points are supported. Polylines with more than two nodes have no uniform direction.

The MapCAD tool must be loaded. These functions require no active map window. Notice: The calculation of the angle is based on the session projection.

Parameters Description
LineObj Object value, Line or Polyline with two points

Examples

Dim t as float 
Set CoordSys … 
t = Exec("MapCAD.mbx","CartesianDirection",LineObj) 
note "Direction = " + t