OSMAR library error (OpenStreetMap)

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 clue about what's going on? Because my code is small and the error was right at the beginning.

Thanks in advance,

    
asked by anonymous 12.06.2018 / 02:49

1 answer

3

This error is an access problem to 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 api url 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
    
12.06.2018 / 13:05