Issues with OSM encoding

279 views Asked by At

I am having troubles with the encoding of the osm data. Here is a reproducible example using the osmar package:

 osmData <- osmar::get_osm(osmar::center_bbox(23.334360, 42.693180, 100, 100))
 osmData$nodes$tags[80:100, ] #the output is not UTF-8

I have also downloaded a planet file from https://download.geofabrik.de/europe/

After unzipping it and using it with osmar::get_osm I still have the same issue. The cyrilics letters are not readable.

Any ideas how can I counter this?

1

There are 1 answers

0
deann On BEST ANSWER

Ok, Answering my own question:

I ran the above code in linux and understood that the issue was with the windows locale. The workaround I found was to use iconv with from and to parameters set to "UTF-8".

iconv(osmData$nodes$tags[80:100,3][11], from="UTF-8", to="UTF-8") 

This works and could be applied to all columns.