'create additional polylines from existing polylines
I'm looking for a way to fill out a polygon area with additional polylines that are offsetting the originals that maximize the line length whenever possible up to a certain distance (ie, the line cannot be longer than 20,000 feet). Below is an example showing the original polylines and new polylines I've added manually..I also know the new lines are perfect but wanted to provide an example that i'm after.
Additional Lines Manually Drawn

example data output
original<-
structure(list(Name = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_), geometry = structure(list(structure(c(-121.435466639,
-121.411553056, 46.3509518230001, 46.284564861), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg")), structure(c(-121.400131643,
-121.37621806, 46.3552348530001, 46.288847891), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg")), structure(c(-121.419405278,
-121.395491695, 46.3627301560001, 46.296343194), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg")), structure(c(-121.387282554,
-121.425472903, 46.218891737, 46.1799875500001), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg")), structure(c(-121.376931899,
-121.415122248, 46.2138948690001, 46.174990682), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg")), structure(c(-121.363368972,
-121.401559321, 46.2128241120001, 46.1739199250001), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg")), structure(c(-121.485435321,
-121.47722618, 46.2895617290001, 46.224959362), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg")), structure(c(-121.497213653,
-121.489004512, 46.289204811, 46.224602444), .Dim = c(2L, 2L), class = c("XY",
"LINESTRING", "sfg")), structure(c(-121.507564309, -121.499355168,
46.289204811, 46.224602444), .Dim = c(2L, 2L), class = c("XY",
"LINESTRING", "sfg"))), n_empty = 0L, crs = structure(list(input = "NAD27",
wkt = "GEOGCRS[\"NAD27\",\n DATUM[\"North American Datum 1927\",\n ELLIPSOID[\"Clarke 1866\",6378206.4,294.978698213898,\n LENGTHUNIT[\"metre\",1]]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n CS[ellipsoidal,2],\n AXIS[\"latitude\",north,\n ORDER[1],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n AXIS[\"longitude\",east,\n ORDER[2],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n ID[\"EPSG\",4267]]"), class = "crs"), class = c("sfc_LINESTRING",
"sfc"), precision = 0, bbox = structure(c(xmin = -121.507564309,
ymin = 46.1739199250001, xmax = -121.363368972, ymax = 46.3627301560001
), class = "bbox"))), row.names = c(NA, -9L), class = c("sf",
"tbl_df", "tbl", "data.frame"), sf_column = "geometry", agr = structure(c(Name = NA_integer_), class = "factor", .Label = c("constant",
"aggregate", "identity")))
new_lines<- structure(list(Name = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), geometry = structure(list(
structure(c(-121.423331386, -121.399417803, 46.297413949,
46.2310269870001), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.420832953, -121.412623812, 46.2738572860001,
46.2313839070001), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.43046977, -121.422260629, 46.2745711250001,
46.2320977460001), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.440463507, -121.432254366, 46.2717157720001,
46.229242393), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.450814163, -121.442605022, 46.2720726910001,
46.220319412), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.406556186, -121.382642603, 46.2838510220001,
46.2174640600001), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.389424067, -121.365510484, 46.286706376,
46.2203194140001), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.37586114, -121.351947557, 46.286706376,
46.2203194140001), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.416193005, -121.454383354, 46.2406638030001,
46.2017596160001), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.40584235, -121.444032699, 46.234239259,
46.195335072), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.396562452, -121.434752801, 46.2274577960001,
46.1885536090001), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.465090929, -121.456881788, 46.288490971,
46.2238886040001), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.474370827, -121.466161686, 46.290275567,
46.2256732000001), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.47686926, -121.452955677, 46.330250511,
46.2638635490001), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.462949413, -121.43903583, 46.3370319750001,
46.270645013), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg")), structure(c(-121.450457243, -121.42654366, 46.3448841970001,
46.278497235), .Dim = c(2L, 2L), class = c("XY", "LINESTRING",
"sfg"))), n_empty = 0L, crs = structure(list(input = "NAD27",
wkt = "GEOGCRS[\"NAD27\",\n DATUM[\"North American Datum 1927\",\n ELLIPSOID[\"Clarke 1866\",6378206.4,294.978698213898,\n LENGTHUNIT[\"metre\",1]]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n CS[ellipsoidal,2],\n AXIS[\"latitude\",north,\n ORDER[1],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n AXIS[\"longitude\",east,\n ORDER[2],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n ID[\"EPSG\",4267]]"), class = "crs"), class = c("sfc_LINESTRING",
"sfc"), precision = 0, bbox = structure(c(xmin = -121.47686926,
ymin = 46.1885536090001, xmax = -121.351947557, ymax = 46.3448841970001
), class = "bbox"))), row.names = c(NA, -16L), class = c("sf",
"tbl_df", "tbl", "data.frame"), sf_column = "geometry", agr = structure(c(Name = NA_integer_), class = "factor", .Label = c("constant",
"aggregate", "identity")))
polygon<- structure(list(Name = NA_character_, geometry = structure(list(
structure(list(structure(c(-121.376931899, -121.401202402,
-121.4272575, -121.455454112, -121.464020172, -121.473656989,
-121.487576836, -121.501496683, -121.510062743, -121.512918096,
-121.515059611, -121.516844206, -121.516844206, -121.513631934,
-121.498284411, -121.478296938, -121.453669517, -121.434395883,
-121.419048359, -121.393707099, -121.377645738, -121.370864274,
-121.360870538, -121.353375235, -121.346236852, -121.344452257,
-121.348735286, -121.376931899, 46.1735630060001, 46.162855431,
46.1703507330001, 46.1853413380001, 46.1996181040001, 46.2085410830001,
46.213537951, 46.2185348190001, 46.2281716360001, 46.2431622400001,
46.2581528440001, 46.2856356190001, 46.3020539, 46.318115262,
46.3320351090001, 46.3459549560001, 46.356305611, 46.3630870750001,
46.365942428, 46.3630870750001, 46.3595178830001, 46.34845339,
46.3209706150001, 46.288847891, 46.2488729470001, 46.23067007,
46.2106825970001, 46.1735630060001), .Dim = c(28L, 2L))), class = c("XY",
"POLYGON", "sfg"))), n_empty = 0L, crs = structure(list(input = "NAD27",
wkt = "GEOGCRS[\"NAD27\",\n DATUM[\"North American Datum 1927\",\n ELLIPSOID[\"Clarke 1866\",6378206.4,294.978698213898,\n LENGTHUNIT[\"metre\",1]]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n CS[ellipsoidal,2],\n AXIS[\"latitude\",north,\n ORDER[1],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n AXIS[\"longitude\",east,\n ORDER[2],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n ID[\"EPSG\",4267]]"), class = "crs"), class = c("sfc_POLYGON",
"sfc"), precision = 0, bbox = structure(c(xmin = -121.516844206,
ymin = 46.162855431, xmax = -121.344452257, ymax = 46.365942428
), class = "bbox"))), row.names = c(NA, -1L), class = c("sf",
"tbl_df", "tbl", "data.frame"), sf_column = "geometry", agr = structure(c(Name = NA_integer_), class = "factor", .Label = c("constant",
"aggregate", "identity")))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

