DISTANCE_TO_POSITION
Estimate city positions from distance tables.


DISTANCE_TO_POSITION, a FORTRAN90 code which estimates the positions of cities given a city-to-city distance table.

In 2D, the problem is singular. In particular, the position of one city is completely arbitrary, and one component of a second city is completely arbitrary (and a third city's position can be "flipped" about the line connecting cities one and two). To remove some of this singularity, the code assigns city #1 the position (0,0) and city #2 is given a 0 Y coordinate.

In N-dimensional space, a similar set of constraints must be placed on the first N cities, or the least squares solver is likely to fail. (That is, we specify all N components of the first city to be 0, N-1 components of the second one, and so on, up to the N-th city which has a single 0 component).

The computations carried out by this code assume that the cities lie on a plane. If the distance data is for international cities, the effect of spherical geometry may make the planar approximation very bad.

Once the nonlinear least squares problem is set up, the routine UNCMIN from the NMS software package is called to compute a solution.

Usage:

distance_to_position distance.txt
where estimates the positions of the cities, and writes out a position table in distance.coord.txt.

Licensing:

The computer code and data files made available on this web page are distributed under the MIT license

Related Data and codes:

distance_to_position, a FORTRAN90 code which estimates the positions of cities based on a city-to-city distance table.

Source Code:


Last revised on 18 June 2020.