# calc_isochrones: Isochrones calculation In spNetwork: Spatial Analysis on Network

## Description

Calculate isochrones on a network

## Usage

 ```1 2 3 4 5 6 7 8``` ```calc_isochrones( lines, dists, start_points, mindist = 1, weight = NULL, direction = NULL ) ```

## Arguments

 `lines` A SpatialLinesDataFrame representing the edges of the network `dists` A vector of the size of the desired isochrones `start_points` A SpatialPointsDataFrame representing the starting points if the isochrones `mindist` The minimum distance between two points. When two points are too close, they might end up snapped at the same location on a line. Default is 1. `weight` The name of the column in lines to use an edge weight. If NULL, the geographical length is used. Note that if lines are split during the network creation, the weight column is recalculated proportionally to the new lines length. `direction` The name of the column indicating authorized travelling direction on lines. if NULL, then all lines can be used in both directions (undirected). The values of the column must be "FT" (From - To), "TF" (To - From) or "Both".

## Details

An isochrone is the set of reachable lines around a node in a network within a specified distance (or time). This function perform dynamic segmentation to return the part of the edges reached and not only the fully covered edges. Several start points and several distances can be given. The network can also be directed. The lines returned by the function are the most accurate representation of the isochrones. However, if polygons are required for mapping, the vignette "Calculating isochrones" shows how to create smooth polygons from the returned sets of lines.

## Value

A SpatialLinesDataFrame representing the isochrones with the following columns

• point_id: the index of the point at the centre of the isochrone

• distance: the size of the isochrone

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40``` ```library(sp) # creating a simple network wkt_lines <- c( "LINESTRING (0.0 0.0, 5.0 0.0)", "LINESTRING (0.0 -5.0, 5.0 -5.0)", "LINESTRING (5.0 0.0, 5.0 5.0)", "LINESTRING (5.0 -5.0, 5.0 -10.0)", "LINESTRING (5.0 0.0, 5.0 -5.0)", "LINESTRING (5.0 0.0, 10.0 0.0)", "LINESTRING (5.0 -5.0, 10.0 -5.0)", "LINESTRING (10.0 0, 10.0 -5.0)", "LINESTRING (10.0 -10.0, 10.0 -5.0)", "LINESTRING (15.0 -5.0, 10.0 -5.0)", "LINESTRING (10.0 0.0, 15.0 0.0)", "LINESTRING (10.0 0.0, 10.0 5.0)") linesdf <- data.frame(wkt = wkt_lines, id = paste("l",1:length(wkt_lines),sep="")) geoms <- do.call(rbind,lapply(1:nrow(linesdf),function(i){ txt <- as.character(linesdf[i,]\$wkt) geom <- rgeos::readWKT(txt,id=i) return(geom) })) lines <- SpatialLinesDataFrame(geoms, linesdf, match.ID = FALSE) # and the definition of the starting point start_points <- data.frame(x=c(5), y=c(-2.5)) coordinates(start_points) <- cbind(start_points\$x,start_points\$y) # setting the directions lines\$direction <- "Both" lines[6,"direction"] <- "TF" isochrones <- calc_isochrones(lines, dists = c(10,12), start_points = start_points, direction = "direction") ```

spNetwork documentation built on Oct. 30, 2021, 5:06 p.m.