gpt4 book ai didi

r - osmar::get_osm()下载OSM数据时出错:SYSTEM或PUBLIC,缺少URI

转载 作者:行者123 更新时间:2023-12-04 17:15:22 27 4
gpt4 key购买 nike

我正在关注tutorial有关如何使用osmar软件包在R中下载OSM数据的信息,因此代码为:

library(osmar)
src <- osmsource_api()
bb <- center_bbox(174.76778, -36.85056, 700, 700)
ua <- get_osm(bb, source = src)

当我运行这最后一行时,出现此错误:
Space required after the Public Identifier
SystemLiteral " or ' expected
SYSTEM or PUBLIC, the URI is missing
Opening and ending tag mismatch: hr line 7 and body
Opening and ending tag mismatch: body line 4 and html
Premature end of data in tag html line 2
Error: 1: Space required after the Public Identifier
2: SystemLiteral " or ' expected
3: SYSTEM or PUBLIC, the URI is missing
4: Opening and ending tag mismatch: hr line 7 and body
5: Opening and ending tag mismatch: body line 4 and html
6: Premature end of data in tag html line 2

我不确定这意味着什么。当我搜索此错误时,我只能看到与Bioconductor和biomaRt相关的内容,与我的工作无关。但是,我认为这与R与OSM网站(?)的连接有关。所以我想知道是否有人知道如何修复它的提示。谢谢!

最佳答案

您看到的错误消息是指服务器的以下响应。基本上,这意味着osmar软件包正尝试通过HTTP下载,但是服务器会将您重定向到HTTPS位置。出于某种原因,osmar不遵循此重定向并失败。您可能应该将此问题报告给软件包所有者,以解决此问题。

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://www.openstreetmap.org/api/0.6/map/?bbox=174.763855598139,-36.8537138679267,174.771704401861,-36.8474061320733">here</a>.</p>
<hr>
<address>Apache/2.4.18 (Ubuntu) Server at api.openstreetmap.org Port 80</address>
</body></html>

一种简单的解决方法是使用HTTPS提供正确的URL:
src <- osmsource_api(url = "https://api.openstreetmap.org/api/0.6/")

旁注:OSM API(您正在使用的端点)仅用于编辑 map 。因此,毕竟这可能违反了该服务的使用条款。最好使用一些基于OSM镜像或Overpass API的替代方法。

关于r - osmar::get_osm()下载OSM数据时出错:SYSTEM或PUBLIC,缺少URI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50428697/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com