multilinestring class

multilinestring(x)

Arguments

x

input

Examples

x <- '{ "type": "MultiLineString", "coordinates": [ [ [100.0, 0.0], [101.0, 1.0] ], [ [102.0, 2.0], [103.0, 3.0] ] ] }' (y <- multilinestring(x))
#> <MultiLineString> #> no. lines: 2 #> no. nodes / line: 2, 2 #> coordinates: [[[100,0],[101,1]],[[102,2],[103,3]]]
y[1]
#> [1] "{ \"type\": \"MultiLineString\",\n \"coordinates\": [ [ [100.0, 0.0], [101.0, 1.0] ], [ [102.0, 2.0], [103.0, 3.0] ] ] }"
#> [1] "MultiLineString"
#> { #> "type": "MultiLineString", #> "coordinates": [ #> [ #> [ #> 100.0, #> 0.0 #> ], #> [ #> 101.0, #> 1.0 #> ] #> ], #> [ #> [ #> 102.0, #> 2.0 #> ], #> [ #> 103.0, #> 3.0 #> ] #> ] #> ] #> } #>
geo_write(y, f <- tempfile(fileext = ".geojson")) jsonlite::fromJSON(f, FALSE)
#> $type #> [1] "MultiLineString" #> #> $coordinates #> $coordinates[[1]] #> $coordinates[[1]][[1]] #> $coordinates[[1]][[1]][[1]] #> [1] 100 #> #> $coordinates[[1]][[1]][[2]] #> [1] 0 #> #> #> $coordinates[[1]][[2]] #> $coordinates[[1]][[2]][[1]] #> [1] 101 #> #> $coordinates[[1]][[2]][[2]] #> [1] 1 #> #> #> #> $coordinates[[2]] #> $coordinates[[2]][[1]] #> $coordinates[[2]][[1]][[1]] #> [1] 102 #> #> $coordinates[[2]][[1]][[2]] #> [1] 2 #> #> #> $coordinates[[2]][[2]] #> $coordinates[[2]][[2]][[1]] #> [1] 103 #> #> $coordinates[[2]][[2]][[2]] #> [1] 3 #> #> #> #>
unlink(f) file <- system.file("examples", 'multilinestring_one.geojson', package = "geojson") con <- file(file) str <- paste0(readLines(con), collapse = " ") (y <- multilinestring(str))
#> <MultiLineString> #> no. lines: 2 #> no. nodes / line: 80, 20 #> coordinates: [[[-80.51399230957031,28.069556808283608],[-80.51193237304688,28.05743 ...
y[1]
#> [1] "{\"type\":\"MultiLineString\",\"coordinates\":[[[-80.51399230957031,28.069556808283608],[-80.51193237304688,28.057438520876673],[-80.49819946289062,28.05622661698537],[-80.5023193359375,28.04471284867091],[-80.48583984375,28.042288740362853],[-80.50575256347656,28.028349057505775],[-80.50163269042969,28.02168161433489],[-80.49476623535156,28.021075462659883],[-80.48652648925781,28.021075462659883],[-80.47691345214844,28.021075462659883],[-80.46936035156249,28.015619944017807],[-80.47760009765624,28.007133032319448],[-80.49201965332031,27.998039170620494],[-80.46730041503906,27.962262536875905],[-80.46524047851562,27.91980029694533],[-80.40550231933594,27.930114089618602],[-80.39657592773438,27.980455528671527],[-80.41305541992188,27.982274659104082],[-80.42953491210938,27.990763528690582],[-80.4144287109375,28.00955793247135],[-80.3594970703125,27.972572275562527],[-80.36224365234375,27.948919060105453],[-80.38215637207031,27.913732900444284],[-80.41786193847656,27.881570017022806],[-80.40550231933594,27.860932192608534],[-80.39382934570312,27.85425440786446],[-80.37803649902344,27.86336037597851],[-80.38215637207031,27.880963078302393],[-80.36842346191405,27.888246118437756],[-80.35743713378906,27.882176952341734],[-80.35469055175781,27.86882358965466],[-80.3594970703125,27.8421119273228],[-80.37940979003906,27.83300417483936],[-80.39932250976561,27.82511017099003],[-80.40069580078125,27.79352841586229],[-80.36155700683594,27.786846483587688],[-80.35537719726562,27.794743268514615],[-80.36705017089844,27.800209937418252],[-80.36889553070068,27.801918215058347],[-80.3690242767334,27.803930152059845],[-80.36713600158691,27.805942051806845],[-80.36584854125977,27.805524490772143],[-80.36563396453857,27.80465140342285],[-80.36619186401367,27.803095012921272],[-80.36623477935791,27.801842292177923],[-80.36524772644043,27.80127286888392],[-80.36224365234375,27.801158983867033],[-80.36065578460693,27.802639479776524],[-80.36138534545898,27.803740348273823],[-80.36220073699951,27.804803245204976],[-80.36190032958984,27.806625330038287],[-80.3609561920166,27.80742248254359],[-80.35932540893555,27.806853088493792],[-80.35889625549315,27.806321651354835],[-80.35902500152588,27.805448570411585],[-80.35863876342773,27.804461600896783],[-80.35739421844482,27.804461600896783],[-80.35700798034668,27.805334689771293],[-80.35696506500244,27.80673920932572],[-80.35726547241211,27.80772615814989],[-80.35808086395264,27.808295547623707],[-80.3585958480835,27.80928248230861],[-80.35653591156006,27.80943431761813],[-80.35572052001953,27.808637179875486],[-80.3555917739868,27.80772615814989],[-80.3555917739868,27.806055931810487],[-80.35572052001953,27.803778309057556],[-80.35537719726562,27.801804330717825],[-80.3554630279541,27.799564581098746],[-80.35670757293701,27.799564581098746],[-80.35499095916748,27.796831264786892],[-80.34610748291016,27.79478123244122],[-80.34404754638672,27.802070060660014],[-80.34748077392578,27.804955086774896],[-80.3433609008789,27.805790211616266],[-80.34353256225586,27.8101555324401],[-80.33499240875244,27.810079615315917],[-80.33383369445801,27.805676331334084],[-80.33022880554199,27.801652484744796],[-80.32872676849365,27.80848534345178]],[[-80.51193237304688,28.091366281406945],[-80.47760009765624,28.074403740607135],[-80.47210693359375,28.058650411105386],[-80.46936035156249,28.01016414897993],[-80.45425415039061,27.99682659773872],[-80.44464111328125,28.02956127552927],[-80.43228149414062,28.024712321517228],[-80.40069580078125,28.01743848094423],[-80.3704833984375,28.004101830368654],[-80.35537719726562,27.991976169784156],[-80.3485107421875,27.947099367319762],[-80.32379150390625,27.937393821330247],[-80.34027099609375,27.879142241732627],[-80.35263061523436,27.90948552034696],[-80.36773681640625,27.858503954841247],[-80.34027099609375,27.822073862795612],[-80.29220581054688,27.853647316127383],[-80.30319213867188,27.860932192608534],[-80.30319213867188,27.88278388425912],[-80.2935791015625,27.894921808206057]]]}"
#> [1] "MultiLineString"
#> { #> "type": "MultiLineString", #> "coordinates": [ #> [ #> [ #> -80.51399230957031, #> 28.069556808283608 #> ], #> [ #> -80.51193237304688, #> 28.057438520876673 #> ], #> [ #> -80.49819946289062, #> 28.05622661698537 #> ], #> [ #> -80.5023193359375, #> 28.04471284867091 #> ], #> [ #> -80.48583984375, #> 28.042288740362853 #> ], #> [ #> -80.50575256347656, #> 28.028349057505775 #> ], #> [ #> -80.50163269042969, #> 28.02168161433489 #> ], #> [ #> -80.49476623535156, #> 28.021075462659883 #> ], #> [ #> -80.48652648925781, #> 28.021075462659883 #> ], #> [ #> -80.47691345214844, #> 28.021075462659883 #> ], #> [ #> -80.46936035156249, #> 28.015619944017807 #> ], #> [ #> -80.47760009765624, #> 28.007133032319448 #> ], #> [ #> -80.49201965332031, #> 27.998039170620494 #> ], #> [ #> -80.46730041503906, #> 27.962262536875905 #> ], #> [ #> -80.46524047851562, #> 27.91980029694533 #> ], #> [ #> -80.40550231933594, #> 27.930114089618602 #> ], #> [ #> -80.39657592773438, #> 27.980455528671527 #> ], #> [ #> -80.41305541992188, #> 27.982274659104082 #> ], #> [ #> -80.42953491210938, #> 27.990763528690582 #> ], #> [ #> -80.4144287109375, #> 28.00955793247135 #> ], #> [ #> -80.3594970703125, #> 27.972572275562527 #> ], #> [ #> -80.36224365234375, #> 27.948919060105453 #> ], #> [ #> -80.38215637207031, #> 27.913732900444284 #> ], #> [ #> -80.41786193847656, #> 27.881570017022806 #> ], #> [ #> -80.40550231933594, #> 27.860932192608534 #> ], #> [ #> -80.39382934570312, #> 27.85425440786446 #> ], #> [ #> -80.37803649902344, #> 27.86336037597851 #> ], #> [ #> -80.38215637207031, #> 27.880963078302393 #> ], #> [ #> -80.36842346191405, #> 27.888246118437756 #> ], #> [ #> -80.35743713378906, #> 27.882176952341734 #> ], #> [ #> -80.35469055175781, #> 27.86882358965466 #> ], #> [ #> -80.3594970703125, #> 27.8421119273228 #> ], #> [ #> -80.37940979003906, #> 27.83300417483936 #> ], #> [ #> -80.39932250976561, #> 27.82511017099003 #> ], #> [ #> -80.40069580078125, #> 27.79352841586229 #> ], #> [ #> -80.36155700683594, #> 27.786846483587688 #> ], #> [ #> -80.35537719726562, #> 27.794743268514615 #> ], #> [ #> -80.36705017089844, #> 27.800209937418252 #> ], #> [ #> -80.36889553070068, #> 27.801918215058347 #> ], #> [ #> -80.3690242767334, #> 27.803930152059845 #> ], #> [ #> -80.36713600158691, #> 27.805942051806845 #> ], #> [ #> -80.36584854125977, #> 27.805524490772143 #> ], #> [ #> -80.36563396453857, #> 27.80465140342285 #> ], #> [ #> -80.36619186401367, #> 27.803095012921272 #> ], #> [ #> -80.36623477935791, #> 27.801842292177923 #> ], #> [ #> -80.36524772644043, #> 27.80127286888392 #> ], #> [ #> -80.36224365234375, #> 27.801158983867033 #> ], #> [ #> -80.36065578460693, #> 27.802639479776524 #> ], #> [ #> -80.36138534545898, #> 27.803740348273823 #> ], #> [ #> -80.36220073699951, #> 27.804803245204976 #> ], #> [ #> -80.36190032958984, #> 27.806625330038287 #> ], #> [ #> -80.3609561920166, #> 27.80742248254359 #> ], #> [ #> -80.35932540893555, #> 27.806853088493792 #> ], #> [ #> -80.35889625549315, #> 27.806321651354835 #> ], #> [ #> -80.35902500152588, #> 27.805448570411585 #> ], #> [ #> -80.35863876342773, #> 27.804461600896783 #> ], #> [ #> -80.35739421844482, #> 27.804461600896783 #> ], #> [ #> -80.35700798034668, #> 27.805334689771293 #> ], #> [ #> -80.35696506500244, #> 27.80673920932572 #> ], #> [ #> -80.35726547241211, #> 27.80772615814989 #> ], #> [ #> -80.35808086395264, #> 27.808295547623707 #> ], #> [ #> -80.3585958480835, #> 27.80928248230861 #> ], #> [ #> -80.35653591156006, #> 27.80943431761813 #> ], #> [ #> -80.35572052001953, #> 27.808637179875486 #> ], #> [ #> -80.3555917739868, #> 27.80772615814989 #> ], #> [ #> -80.3555917739868, #> 27.806055931810487 #> ], #> [ #> -80.35572052001953, #> 27.803778309057556 #> ], #> [ #> -80.35537719726562, #> 27.801804330717825 #> ], #> [ #> -80.3554630279541, #> 27.799564581098746 #> ], #> [ #> -80.35670757293701, #> 27.799564581098746 #> ], #> [ #> -80.35499095916748, #> 27.796831264786892 #> ], #> [ #> -80.34610748291016, #> 27.79478123244122 #> ], #> [ #> -80.34404754638672, #> 27.802070060660014 #> ], #> [ #> -80.34748077392578, #> 27.804955086774896 #> ], #> [ #> -80.3433609008789, #> 27.805790211616266 #> ], #> [ #> -80.34353256225586, #> 27.8101555324401 #> ], #> [ #> -80.33499240875244, #> 27.810079615315917 #> ], #> [ #> -80.33383369445801, #> 27.805676331334084 #> ], #> [ #> -80.33022880554199, #> 27.801652484744796 #> ], #> [ #> -80.32872676849365, #> 27.80848534345178 #> ] #> ], #> [ #> [ #> -80.51193237304688, #> 28.091366281406945 #> ], #> [ #> -80.47760009765624, #> 28.074403740607135 #> ], #> [ #> -80.47210693359375, #> 28.058650411105386 #> ], #> [ #> -80.46936035156249, #> 28.01016414897993 #> ], #> [ #> -80.45425415039061, #> 27.99682659773872 #> ], #> [ #> -80.44464111328125, #> 28.02956127552927 #> ], #> [ #> -80.43228149414062, #> 28.024712321517228 #> ], #> [ #> -80.40069580078125, #> 28.01743848094423 #> ], #> [ #> -80.3704833984375, #> 28.004101830368654 #> ], #> [ #> -80.35537719726562, #> 27.991976169784156 #> ], #> [ #> -80.3485107421875, #> 27.947099367319762 #> ], #> [ #> -80.32379150390625, #> 27.937393821330247 #> ], #> [ #> -80.34027099609375, #> 27.879142241732627 #> ], #> [ #> -80.35263061523436, #> 27.90948552034696 #> ], #> [ #> -80.36773681640625, #> 27.858503954841247 #> ], #> [ #> -80.34027099609375, #> 27.822073862795612 #> ], #> [ #> -80.29220581054688, #> 27.853647316127383 #> ], #> [ #> -80.30319213867188, #> 27.860932192608534 #> ], #> [ #> -80.30319213867188, #> 27.88278388425912 #> ], #> [ #> -80.2935791015625, #> 27.894921808206057 #> ] #> ] #> ] #> } #>
close(con) # add to a data.frame library('tibble') tibble(a = 1:5, b = list(y))
#> # A tibble: 5 x 2 #> a b #> <int> <list> #> 1 1 <gmltlnst [1]> #> 2 2 <gmltlnst [1]> #> 3 3 <gmltlnst [1]> #> 4 4 <gmltlnst [1]> #> 5 5 <gmltlnst [1]>