OSMAR library (Openstreetmap) error

Asked

Viewed 248 times

3

Hello, I’m trying to use the OSMAR library in R to plot routes and I’m not getting it.

library(osmar)
library(leaflet)
library(igraph)

src <- osmsource_api()

get_osm(node(18961430), source = src)

The following error is appearing:

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

Would anyone have a hint about what’s going on? Because my code is minute and the error was right at the beginning.

from now on, thank you

1 answer

4


This error is a problem of accessing the open street map server where the data is stored. Basically, the package is outdated and tries to access using the http protocol, but currently only accesses via https are allowed. One way to solve this problem is by explicitly declaring the url of the api using https:

library(osmar)
library(leaflet)
library(igraph)

src <- osmsource_api(url = "https://api.openstreetmap.org/api/0.6/")

get_osm(node(18961430), source = src)
osmar object
1 nodes, 0 ways, 0 relations

Browser other questions tagged

You are not signed in. Login or sign up in order to post.