索引超出范围SpatialLinesNetwork

时间:2019-01-16 15:54:48

标签: r stplanr

error: Mat::rows(): indices out of bounds or incorrectly used
Error in coord_matches_sf(as.matrix(nodecoords %>% dplyr::select(.data$X,  : 
  Mat::rows(): indices out of bounds or incorrectly used

我正在使用从OSM数据创建的SF对象,无法运行SpatialLinesNetwork函数。与spDataLarge的bristol_ways数据进行比较时,它看起来还不错。就像bristol_ways对象一样,坐标系是WGS_84。我不确定超出范围的索引是指什么。从spatialLinesDataFrame到sf对象的转换似乎发生了一些事情。该操作适用于spatialLinesDataFrame,但是一旦转换为sf,就会引发此错误。

sub <- roadsReclass%>%
+ select('osm_id','Class','Speed')
> head(sub)
Simple feature collection with 6 features and 3 fields
geometry type:  MULTILINESTRING
dimension:      XY
bbox:           xmin: -78.2483 ymin: 35.77927 xmax: -77.49125 ymax: 35.93404
epsg (SRID):    4326
proj4string:    +proj=longlat +datum=WGS84 +no_defs
      osm_id Class Speed                       geometry
349 15121364 local    25 MULTILINESTRING ((-78.24809...
350 16538303 local    25 MULTILINESTRING ((-77.648 3...
351 16538305 local    25 MULTILINESTRING ((-77.62865...
352 16538306 local    25 MULTILINESTRING ((-77.70429...
353 16538307 local    25 MULTILINESTRING ((-77.49166...
354 16538308 local    25 MULTILINESTRING ((-77.75948...
> st_crs(sub)
Coordinate Reference System:
  EPSG: 4326 
  proj4string: "+proj=longlat +datum=WGS84 +no_defs"
> sln <- SpatialLinesNetwork(sub)

error: Mat::rows(): indices out of bounds or incorrectly used
Error in coord_matches_sf(as.matrix(nodecoords %>% dplyr::select(.data$X,  : 
  Mat::rows(): indices out of bounds or incorrectly used

我还尝试将其投影到2264(北卡罗来纳州NAD83),并使用uselonglat = FALSE运行它。

0 个答案:

没有答案