Map and Table Calculation

DIST2( ) function

Returns the square of the distance between two coordinates.

Syntax

DIST2(Coordinate a, Coordinate b)

Input

Coordinate a is an (X,Y) coordinate
Domain type: a coordinate system
Coordinate b is an (X,Y) coordinate
Domain type: a coordinate system

Output

DIST2 returns: a value
Domain: system domain Value

Notes:

Tip:

When the definition symbol = is used, a dependent output column is created; when the assignment symbol := is used, the dependency link is immediately broken after the output column has been calculated.

Usable in

Simple calculators, TabCalcMapCalc

Examples

Pocket line calculator examples:

? DIST2(COORD(10,15),COORD(20,20))

returns the square distance between coordinate (10,15) and coordinate (20,20), i.e. 125

? DIST2(COORD(10,15,LatLon),COORD(20,20,LatLonWGS84))

returns the square distance between coordinate (10,15) and coordinate (20,20) ignoring the coordinate systems, i.e. 125

TabCalc example:

Point map Rainfall shows the location of rainfall stations in the area of Cochabamba, Bolivia. To calculate the squared distance between rainfall station PROMIC and all other rainfall stations, type on the command line of the table window:

Distance = DIST2(Coordinate,PNTCRD(Rainfall,"PROMIC"))

Rainfall.mpp opened as table

           

Working table

ID

Name

Coordinate

          

Distance

1

UMSS

(803429.00, 8074631.00)

34911760.000

2

Taquina

(799748.00, 8082415.00)

11940849.000

3

Laguna Santa Rosa

(803511.00, 8087422.00)

48956125.000

4

Laguna Totura

(801281.00, 8088967.00)

73752480.000

5

PROMIC

(802613.00, 8080483.00)

0.000

6

Aro Caqua

(806816.00, 8076585.00)

32859613.000

7

Colca Pithua

(797465.00, 8078352.00)

31043065.000

8

Cerro MachaMach

(796346.00, 8087736.00)

91881298.000

9

Laguna WaraWara

(806042.00, 8085414.00)

36072802.000

See also:

COORD MINCRDX MAPCRD RASVALUE
CRDX MINCRDY MAPROW DIST
CRDY MAXCRDX MAPCOL
TRANSFORM MAXCRDY MAPVALUE