所以我在进行道路网络分析时遇到问题,该分析旨在查看每个公园入口与伦敦南华克区每个邮政编码中心的距离。但是,我在分析中遇到了错误,导致所有距离都为 0,这显然不应该是这种情况。虽然我无法准确指出问题出在哪里,但出现了一条消息,该消息在我过去成功的网络分析中没有出现。我将展示我运行的代码和错误消息,以及我用来提取的包数据
#packages loaded
library(here)
library(magrittr)
library(osmdata)
library(dodgr)
library(sf)
library(expss)
library(tmap)
# Define our bbox coordinates, here our coordinates relate to Southwark
southwark_bbox <- c(-0.121942,51.41078,-0.023347,51.508313)
# Pass our bounding box coordinates into the OverPassQuery (opq) function
osmdata <- opq(bbox = southwark_bbox) %>%
# Pipe this into the add_osm_feature data query function to extract our highways
# Note here, we specify the values we are interested in, omitting motorways
add_osm_feature(key = "highway", value = c("primary", "secondary", "tertiary", "residential",
"path", "footway", "unclassified", "living_street", "pedestrian")) %>%
# And then pipe this into our osmdata_sf object
osmdata_sf()
# Extract our spatial data into variables of their own
# Extract the points, with their osm_id.
southwark_roads_nodes <- osmdata$osm_points[, "osm_id"]
# Extract the lines, with their osm_id, name, type of highway, max speed and
# oneway attributes
southwark_roads_edges <- osmdata$osm_lines[, c("osm_id", "name", "highway", "maxspeed",
"oneway")]
#plotted just to see if Southwark was extracted properly, which it was
plot(southwark_roads_edges)
# Create network graph using are edge data, with the foot weighting profile
southwark_graph <- weight_streetnet(southwark_roads_edges)
正是在我输入的最后一行代码中,我收到一条消息“数据中存在以下高速公路类型但缺少相应的 weight_profile 值:NA”。我不完全确定这意味着什么或为什么这么说。这不是一条错误消息,因为该物体仍在制造中,但后来在我的分析中,它导致每个测量读数都为 0m,这显然是不正确的。如果有人可以指导我正确的方向,请告诉我。