sf::st_intersection 未实现所有点

问题描述 投票:0回答:0

我有两个 sf 文件:x & Riv

我想获得“x”折线与“Riv”线串的交集。为此,我使用了函数

sf::st_intersection(x,Riv)
。 然而,输出不包括与所有“x”线串的所有交集。 (只有 27 对 44)

sf文件'x'来自Riv与前一个sf文件(下图中绿色部分)之间

st_nearest_points()
的应用。那么所有“x”线都应该与“Riv”相交。

我想找到一种方法来在输出中包含所有缺失的 x 行(图中的红色),而不仅仅是选择的少数(图中的蓝色)。

x <- structure(list(structure(c(163340.962516503, 163339.007569445, 
86055.2969082572, 86057.5225402927), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163344.400724905, 163343.429912257, 
86058.3169561776, 86059.4221890382), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163343.975166494, 163343.159782333, 
86057.9431548709, 86058.8714383775), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163340.371658435, 163338.188246187, 
86054.7779113055, 86057.2636421723), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163358.985477678, 163358.405840557, 
86057.1043793742, 86056.243204223), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163337.034088493, 163336.815430932, 
86052.5278108928, 86052.9286830882), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163343.251330057, 163341.479437086, 
86057.3073525952, 86059.3245845931), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163340.38060113, 163339.576337948, 
86054.785766375, 86055.7013890743), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163342.6099935, 163341.283701168, 
86056.7440164302, 86058.2539492389), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163336.398516082, 163335.875658191, 
86052.1811350321, 86053.1397078326), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163359.765722677, 163357.848655319, 
86056.5823423227, 86053.7067412864), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163341.887132772, 163341.429950661, 
86056.109071196, 86056.6295554452), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163341.612846091, 163341.473399649, 
86055.8681437061, 86056.0268981168), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163337.333727026, 163336.984452273, 
86052.6912500924, 86053.3315871395), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163347.378671305, 163347.203945911, 
86060.0021536016, 86060.4972088849), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163330.103100902, 163330.035532865, 
86049.5971912096, 86050.0279374449), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163351.681033356, 163351.828097384, 
86060.6313092021, 86061.3265209692), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163358.810584269, 163359.400106365, 
86057.2220960919, 86058.0979574919), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163320.051020384, 163319.91809282, 
86049.0132598105, 86048.122645136), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163322.057491585, 163321.958762763, 
86048.7137864969, 86048.0523033906), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.663260317, 163321.531477757, 
86048.7726269846, 86047.8896838333), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.720228212, 163321.388596349, 
86048.7641243137, 86046.5421908274), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.179157688, 163321.200699036, 
86048.8448811083, 86048.9892081348), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163355.863493616, 163354.256530111, 
86059.2057148, 86056.8182261633), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.776604765, 163321.528371423, 
86048.7557099029, 86047.0925465152), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163320.763208813, 163320.771370347, 
86048.90696303, 86048.9616453042), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163358.156758331, 163357.230257917, 
86057.662171242, 86056.2856563414), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163329.134219573, 163328.981016192, 
86049.4452098247, 86050.4218813749), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.814856331, 163321.834515089, 
86048.7500007138, 86048.8817143925), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163320.297973082, 163320.356287921, 
86048.9764011989, 86049.3671106212), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.747157576, 163321.715059441, 
86048.7601050058, 86048.545047503), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163356.166413244, 163354.726073394, 
86059.001826589, 86056.8618930979), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163363.182741817, 163363.228177877, 
86054.4241853348, 86055.0754355295), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163514.131668895, 163514.116761467, 
86092.5347591268, 86092.984963432), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163536.571089144, 163536.637359745, 
86093.7360065682, 86092.5002547856), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163423.973839794, 163424.105831473, 
86059.3596477238, 86058.9129066588), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163632.368401207, 163632.39098375, 
86190.762703538, 86190.4820347959), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163444.094941805, 163443.50918856, 
86060.4176706545, 86062.4491127571), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163360.049154527, 163359.108284222, 
86056.3933877558, 86054.982082298), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163356.474576667, 163355.752668853, 
86058.7944089005, 86057.721860148), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163362.583680115, 163361.324256662, 
86054.7037040303, 86052.8145688502), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163413.172675529, 163413.167783795, 
86057.2378796361, 86058.0401240094), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163320.98844555, 163320.710672094, 
86048.8733456066, 86047.0122634526), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.10674043, 163320.715609176, 
86048.8556896544, 86046.2351102559), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg"))), n_empty = 0L, precision = 0, crs = structure(list(
    input = "BD72 / Belgian Lambert 72", wkt = "PROJCRS[\"BD72 / Belgian Lambert 72\",\n    BASEGEOGCRS[\"BD72\",\n        DATUM[\"Reseau National Belge 1972\",\n            ELLIPSOID[\"International 1924\",6378388,297,\n                LENGTHUNIT[\"metre\",1]]],\n        PRIMEM[\"Greenwich\",0,\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        ID[\"EPSG\",4313]],\n    CONVERSION[\"Belgian Lambert 72\",\n        METHOD[\"Lambert Conic Conformal (2SP)\",\n            ID[\"EPSG\",9802]],\n        PARAMETER[\"Latitude of false origin\",90,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8821]],\n        PARAMETER[\"Longitude of false origin\",4.36748666666667,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8822]],\n        PARAMETER[\"Latitude of 1st standard parallel\",51.1666672333333,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8823]],\n        PARAMETER[\"Latitude of 2nd standard parallel\",49.8333339,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8824]],\n        PARAMETER[\"Easting at false origin\",150000.013,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8826]],\n        PARAMETER[\"Northing at false origin\",5400088.438,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8827]]],\n    CS[Cartesian,2],\n        AXIS[\"easting (X)\",east,\n            ORDER[1],\n            LENGTHUNIT[\"metre\",1]],\n        AXIS[\"northing (Y)\",north,\n            ORDER[2],\n            LENGTHUNIT[\"metre\",1]],\n    USAGE[\n        SCOPE[\"Engineering survey, topographic mapping.\"],\n        AREA[\"Belgium - onshore.\"],\n        BBOX[49.5,2.5,51.51,6.4]],\n    ID[\"EPSG\",31370]]"), class = "crs"), class = c("sfc_LINESTRING", 
"sfc"), bbox = structure(c(xmin = 163319.91809282, ymin = 86046.2351102559, 
xmax = 163632.39098375, ymax = 86190.762703538), class = "bbox"))
Riv <- structure(list(structure(c(163340.962516503, 163339.007569445, 
86055.2969082572, 86057.5225402927), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163344.400724905, 163343.429912257, 
86058.3169561776, 86059.4221890382), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163343.975166494, 163343.159782333, 
86057.9431548709, 86058.8714383775), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163340.371658435, 163338.188246187, 
86054.7779113055, 86057.2636421723), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163358.985477678, 163358.405840557, 
86057.1043793742, 86056.243204223), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163337.034088493, 163336.815430932, 
86052.5278108928, 86052.9286830882), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163343.251330057, 163341.479437086, 
86057.3073525952, 86059.3245845931), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163340.38060113, 163339.576337948, 
86054.785766375, 86055.7013890743), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163342.6099935, 163341.283701168, 
86056.7440164302, 86058.2539492389), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163336.398516082, 163335.875658191, 
86052.1811350321, 86053.1397078326), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163359.765722677, 163357.848655319, 
86056.5823423227, 86053.7067412864), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163341.887132772, 163341.429950661, 
86056.109071196, 86056.6295554452), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163341.612846091, 163341.473399649, 
86055.8681437061, 86056.0268981168), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163337.333727026, 163336.984452273, 
86052.6912500924, 86053.3315871395), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163347.378671305, 163347.203945911, 
86060.0021536016, 86060.4972088849), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163330.103100902, 163330.035532865, 
86049.5971912096, 86050.0279374449), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163351.681033356, 163351.828097384, 
86060.6313092021, 86061.3265209692), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163358.810584269, 163359.400106365, 
86057.2220960919, 86058.0979574919), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163320.051020384, 163319.91809282, 
86049.0132598105, 86048.122645136), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163322.057491585, 163321.958762763, 
86048.7137864969, 86048.0523033906), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.663260317, 163321.531477757, 
86048.7726269846, 86047.8896838333), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.720228212, 163321.388596349, 
86048.7641243137, 86046.5421908274), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.179157688, 163321.200699036, 
86048.8448811083, 86048.9892081348), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163355.863493616, 163354.256530111, 
86059.2057148, 86056.8182261633), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.776604765, 163321.528371423, 
86048.7557099029, 86047.0925465152), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163320.763208813, 163320.771370347, 
86048.90696303, 86048.9616453042), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163358.156758331, 163357.230257917, 
86057.662171242, 86056.2856563414), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163329.134219573, 163328.981016192, 
86049.4452098247, 86050.4218813749), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.814856331, 163321.834515089, 
86048.7500007138, 86048.8817143925), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163320.297973082, 163320.356287921, 
86048.9764011989, 86049.3671106212), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.747157576, 163321.715059441, 
86048.7601050058, 86048.545047503), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163356.166413244, 163354.726073394, 
86059.001826589, 86056.8618930979), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163363.182741817, 163363.228177877, 
86054.4241853348, 86055.0754355295), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163514.131668895, 163514.116761467, 
86092.5347591268, 86092.984963432), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163536.571089144, 163536.637359745, 
86093.7360065682, 86092.5002547856), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163423.973839794, 163424.105831473, 
86059.3596477238, 86058.9129066588), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163632.368401207, 163632.39098375, 
86190.762703538, 86190.4820347959), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163444.094941805, 163443.50918856, 
86060.4176706545, 86062.4491127571), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163360.049154527, 163359.108284222, 
86056.3933877558, 86054.982082298), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163356.474576667, 163355.752668853, 
86058.7944089005, 86057.721860148), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163362.583680115, 163361.324256662, 
86054.7037040303, 86052.8145688502), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163413.172675529, 163413.167783795, 
86057.2378796361, 86058.0401240094), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163320.98844555, 163320.710672094, 
86048.8733456066, 86047.0122634526), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg")), structure(c(163321.10674043, 163320.715609176, 
86048.8556896544, 86046.2351102559), dim = c(2L, 2L), class = c("XY", 
"LINESTRING", "sfg"))), n_empty = 0L, precision = 0, crs = structure(list(
    input = "BD72 / Belgian Lambert 72", wkt = "PROJCRS[\"BD72 / Belgian Lambert 72\",\n    BASEGEOGCRS[\"BD72\",\n        DATUM[\"Reseau National Belge 1972\",\n            ELLIPSOID[\"International 1924\",6378388,297,\n                LENGTHUNIT[\"metre\",1]]],\n        PRIMEM[\"Greenwich\",0,\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        ID[\"EPSG\",4313]],\n    CONVERSION[\"Belgian Lambert 72\",\n        METHOD[\"Lambert Conic Conformal (2SP)\",\n            ID[\"EPSG\",9802]],\n        PARAMETER[\"Latitude of false origin\",90,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8821]],\n        PARAMETER[\"Longitude of false origin\",4.36748666666667,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8822]],\n        PARAMETER[\"Latitude of 1st standard parallel\",51.1666672333333,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8823]],\n        PARAMETER[\"Latitude of 2nd standard parallel\",49.8333339,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8824]],\n        PARAMETER[\"Easting at false origin\",150000.013,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8826]],\n        PARAMETER[\"Northing at false origin\",5400088.438,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8827]]],\n    CS[Cartesian,2],\n        AXIS[\"easting (X)\",east,\n            ORDER[1],\n            LENGTHUNIT[\"metre\",1]],\n        AXIS[\"northing (Y)\",north,\n            ORDER[2],\n            LENGTHUNIT[\"metre\",1]],\n    USAGE[\n        SCOPE[\"Engineering survey, topographic mapping.\"],\n        AREA[\"Belgium - onshore.\"],\n        BBOX[49.5,2.5,51.51,6.4]],\n    ID[\"EPSG\",31370]]"), class = "crs"), class = c("sfc_LINESTRING", 
"sfc"), bbox = structure(c(xmin = 163319.91809282, ymin = 86046.2351102559, 
xmax = 163632.39098375, ymax = 86190.762703538), class = "bbox"))

r spatial sf
© www.soinside.com 2019 - 2024. All rights reserved.