pszufe / OpenStreetMapX.jl

OpenStreetMap (*.osm) support for Julia 1.0 and up
MIT License
118 stars 24 forks source link

Error: key OpenStreetMapX [...] not found (solved by deleting old .osm.cache files) #30

Closed harveydevereux closed 3 years ago

harveydevereux commented 3 years ago

I saw this Julialang post ERROR: KeyError: key OpenStreetMapX [5c67c38e-c187-11e8-2be6-e3a6a3a5610f] not found and I was having the same problem.

I believe the issue lies in old .osm.cache files (or at least that's one way to generate the same error). I no longer have any issue once I deleted these. Probably due to the package ID change mentioned in the discourse thread, since I had an old repo from years ago.

Feel free to mark this as closed, just thought it would be worth having it on record.

To summarise the error/fix

julia> get_map_data("~/Map.osm",use_cache=true) # with an old Map.osm.cache in ~/ so I guess it uses it
ERROR: KeyError: key OpenStreetMapX [5c67c38e-c187-11e8-2be6-e3a6a3a5610f] not found

and it is parseMap.jl:L96 that fails.

but it works when not using the bad cache

julia> get_map_data("~/Map.osm",use_cache=false) # even with old Map.osm.cache in ~/
# everything else runs smoothly

and of course it all works fine either way once I deleted the old cache files

Some code to reproduce (including the bad .osm.cache file) error.tar.gz

pszufe commented 3 years ago

Dear @harveydevereux, the caching mechanism is just about serializing the object - so it is just for short term storage (even some update to a dependent package configuration might crash the cached file). I introduced this functionality because parsing huge map files takes lots of time and de-serializing is orders of magnitude faster. Thanks for putting this here - hopefully it should be usable for the others. Thank you for using this package!