gc_endpoints
expands a data frame of with longitude and latitude coordinate columns into one with four columns of lon0
, lat0
, lon1
and lat1
representing pairs of locations.
This is done in preparation for generating great circle arcs between each pair of locations. gc_endpoints
provides the endpoints of these arcs.
See gc_lines
, which is used subsequently on output from gc_endpoints
, to generate an expanded data frame of the corresponding great circle ars.
gc_endpoints
merely splits a data frame into its first and second halves of rows and then expands a table that has rows for every combination of pairs between the first and second halves of the original table.
This is a handy utility function for preparing data for simulated examples of network maps in the current version of mapmate
.
In future versions a more robust gc_endpoints
may offer other more controllable options for assembling location pairs.
When keep=TRUE
columns in data
other than those of longitudes and latitudes are similarly appended with 0
and 1
in the output,
corresponding to the columns lon0/lat0
and to lon1/lat1
, respectively.
If data
contains n
rows, then the data frame returned by gc_endpoints
will contain \((n/2)^2\) rows.