2

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

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.