Skip to contents

Functions to get or set the positions of the destination locations in a spatial interaction model.

Usage

destination_positions(sim)

destination_positions(sim) <- value

Arguments

sim

a spatial interaction model object

value

a matrix with as many rows as the number of destination locations and 2 or 3 columns, or NULL

Value

for destination_positions NULL or coordinate matrix for the destination locations. for destination_positions<- the modified sim object

Positions

Location positions are given by numeric matrices with 2 or 3 columns. The first two columns are assumed to be geographical coordinates while the 3rd column can be used for instance to store altitude. Coordinates are interpreted as is in graphical representations (see autoplot.sim()). They are not matched to the costs as those can be derived from complex movement models and other non purely geographic considerations.

Examples

positions <- matrix(rnorm(10 * 2), ncol = 2)
distances <- as.matrix(dist(positions))
production <- rep(1, 10)
attractiveness <- rep(1, 10)
model <- static_blvim(distances, production, 1.5, 1, attractiveness)
destination_positions(model) <- positions
destination_positions(model)
#>             [,1]        [,2]
#>  [1,]  1.1238388 -0.42938009
#>  [2,] -0.3970015  1.36046133
#>  [3,] -0.8232612 -0.07085743
#>  [4,] -0.5788846 -0.27215368
#>  [5,]  1.7637894 -2.44668003
#>  [6,]  0.1329921  0.06548664
#>  [7,]  0.3764993 -1.09850890
#>  [8,]  1.1387077 -0.63317818
#>  [9,]  1.2412631 -2.06365445
#> [10,]  0.6120909  2.64893203