查询osmdata包时出错:HTTP 405 Method Not allowed

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

最近,在 R 中,每次我尝试通过

osmdata
包查询 OpenStreetMap 数据库时,都会收到以下错误:

Error in `httr2::req_perform()`:
! HTTP 405 Method Not Allowed.

我一直使用这个包直接在 R 中从 OpenStreetMap 下载数据,但现在它不再工作了。这是我尝试使用的代码示例,它应该返回城市的边界框:

library(osmdata)

city_bbox <- getbb(place_name = "Milan, Italy")
r openstreetmap http-status-code-405
2个回答
0
投票

它很好奇,如果我得到这段代码,将 bbox 的边界指定为向量,它就可以工作。

library(osmdata)
library(mapview)
library(sf)
Castalla <- opq (bbox = c (-0.88,38.49,-0.47,38.74)) %>% # 
  add_osm_feature (key = "name", value = "Castalla", value_exact = FALSE) %>%
  osmdata_sf ()

但是尝试文档中的示例仍然失败,并出现 405 错误

q <- opq ("portsmouth usa") %>%
    add_osm_feature (key = "amenity", value = "!restaurant") %>%
    add_osm_feature (key = "amenity", value = "!pub") # There are a lot of these

非常奇怪


0
投票

也许与这个有关?

© www.soinside.com 2019 - 2024. All rights reserved.