Map and Table Calculation

DIST( ) function

Returns the distance between two coordinates.

Syntax

DIST(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

DIST 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, TabCalc, MapCalc

Examples

Pocket line calculator examples:

? DIST(COORD(10,10),COORD(13,14))

returns the distance between coordinate (10,10) and coordinate (13,14), i.e. 5

? DIST(MAPCRD(Geology,1,1),MAPCRD(Geology,1,MAPCOLS(Geology)))

returns the distance (e.g. 12720.000 m) of a pixel at the left boundary and a pixel at the right boundary of map Geology. Since the map has a rectangular shape you can use any row number you like. In this example the first one is taken.

Note: The function MAPCOLS returns the number of columns in a map. Therefore, it is unnecessary to put the map on the screen to find out which column is the last one.

TabCalc example:

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

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

Rainfall.mpp opened as table

           

Working table

ID

Name

Coordinate

Distance

1

UMSS

(803429.00, 8074631.00)

5908.617

2

Taquina

(799748.00, 8082415.00)

3455.553

3

Laguna Santa Rosa

(803511.00, 8087422.00)

6996.865

4

Laguna Totura

(801281.00, 8088967.00)

8587.926

5

PROMIC

(802613.00, 8080483.00)

0.000

6

Aro Caqua

(806816.00, 8076585.00)

5732.331

7

Colca Pithua

(797465.00, 8078352.00)

5571.630

8

Cerro MachaMach

(796346.00, 8087736.00)

9585.473

9

Laguna WaraWara

(806042.00, 8085414.00)

6006.064

Tip

To interactively measure distances in a map, in a plane and/or on a sphere or ellipsoid, use the Measure Distance tool in a map window.

Applied example:

By using the function DIST, you can calculate a map showing an area within a certain distance around a point. When you want to calculate the area within a distance of 2000 m from rainfall station PROMIC, type in the command line of the Main window:

DistPromic = DIST(PNTCRD(Rainfall,"PROMIC"), MAPCRD(Rainfall)) < 2000

Rainfall

DistPromic

Map Rainfall is a raster map showing the location of several rainfall stations. The point indicated by a +, is the rainfall station PROMIC. Map DistPromic shows the area (with a radius of 2000m) around this station.

Note:

This is a an expensive operation in the sense that ILWIS has to calculate for every pixel in the raster map the distance to the location of rainfall station PROMIC; this may take time.

See also:

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