NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I am planning to calculate annual trends in travel time between series of two points in my country of interest. I will be working with R using an "osmdata" package. I realized that historical OSM data are provided with the planet level only. So, I need to crop the huge planet level OSM to the country size and import them into R. Now, I am following a useful post link text. But, it doesn't work, actually from executing SQL codes part in PgAdmin.

So, my first question is that there is anyone familiar with this issue, or know an easier or efficient way to utilize historical OSM via R.

Second, I am curious whether even if I can import the cropped OSM, "osmdata" package is applicable to the historical OSM.

asked 08 Jul '20, 19:58

KCKim's gravatar image

accept rate: 0%

The size typically has country extracts for the 1st Jan of each year going back to 2014 (but may vary by country).

For more flexibility, get the "history extract" for your country from (requires OSM login), and use the "osmium" command line utility (requires Linux) to create snapshots from that for arbitrary points in time.

The link you posted does not seem to apply to history data at all, but to standard planet-wide imports. If you wanted to solve your issue without resorting to Geofabrik downloads, you would download the history planet file from and then first crop it with the osmium tool (not osmosis - it doesn't do history files) and then take a snapshot for a given point in time, again with the osmium utility.

permanent link

answered 08 Jul '20, 20:07

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

Thanks for your quick reply Frederik.

For more clarity, the countries of my interest are India and Nepal. I have many point information (lat long) and so simply want to calculate travel times between the points hopefully via R. The time period is between 2013 and 2016 and I only need one travel time variable for each year. So, I might be able to use the travel time information as of the end of each year, considering the quality of OSM in Nepal in the earlier year (particularly the quality of 2013 information).

Do you still think that the history planet file is suitable for my work? (I already have downloaded it) And, do you mean that I can crop the file into the areas of the countries with the osmium tool, and take a snapshot at the time I need? And, then I can calculate the travel time, using which program?

(09 Jul '20, 19:17) KCKim

If you want to compute routes from Nepal into India and vice versa, then you must use the history planet file. Use osmium to crop it to the area of interest (just once), and then use osmium again (once for each year) to create a snapshot for that year. Then use a routing engine, e.g. Graphhopper which is easy to install, let it load the file for one particular year, and compute all your travel times. Then delete the routing graph, and re-import with the next year, and so on.

PS I am informed that osmium does not require Linux, you can run it on Windows if you can manage to compile it.

(09 Jul '20, 19:29) Frederik Ramm ♦

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 08 Jul '20, 19:58

question was seen: 1,680 times

last updated: 09 Jul '20, 19:29

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum