Sunday, 10 March 2019

openstreetmap - Loading a large osm file in osmar : why does loading time scale quadratically with file size?


I'm trying to load huge .osm files into R in order to run advanced analysis. I did not expect the loading part to be complex, but it proved difficult.


The issue here is that the time it takes to parse the XML file (.osm is xml-like) and populate an object (here an osmar one) seems to be quadratically proportional to the file size.



require(osmar)
my_file = osmsource_file("filename")
osmar_object = get_osm("bla", source = my_file)

And in case you wonder how I found that it was quadratic, here is a representation of the analysis, with files between 0 and 500 Mo.


file size quadratically impacts loading time


At this point, my only chance to make it work seems to be the following : split the country in 100x100 small parts, and load them separately. Obviously, I don't really like the idea.


Why would it be so long ? How can I do so, fast ?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...