wiktorn / Overpass-API

Overpass API docker image
MIT License
133 stars 47 forks source link

Preprocess command fails with error - no such file or directory #122

Open jata1 opened 5 months ago

jata1 commented 5 months ago

I can see when I docker exec into a running/working container that the location of files is correct. So I am trying to process a file that I know exists and is in the correct location but it always says no such file or directory.

I have looked at the script/code in the docker-entrypoint.sh and it looks to be failing the eval statement but it shouldn't as I am using the correct file path.

In the example below - I am just trying to process a .bz2 file using osmium. I know the file exists as I can see it has been downloaded.

overpass-test  | Running preprocessing command: 'osmium tags-filter -o /db/maxspeed.osm.bz2 /db/planet.osm.bz2'
overpass-test  | /app/docker-entrypoint.sh: line 84: osmium tags-filter -o /db/maxspeed.osm.bz2 /db/planet.osm.bz2: No such file or directory
overpass-test  | Failed to process planet file
wiktorn commented 5 months ago

I think that due to how you setup your variable, it is trying to execute file osmium tags-filter -o /db/maxspeed.osm.bz2 /db/planet.osm.bz2 - and this file does not exists. You probably have somewhere extra ' in the variable value

My logs looks like:

Running preprocessing command: mv /db/planet.osm.bz2 /db/planet.osm.pbf && osmium cat -o /db/planet.osm.bz2 /db/planet.osm.pbf && rm /db/planet.osm.pbf

Notice, there are no ' around command.

jata1 commented 5 months ago

Thanks. I tried everything apart from not using either " or ' at all - it is working now.

jata1 commented 5 months ago

Last question.

If I try to download the latest pbf instead of bz2 - will I need to add an additional command to convert it to bz2 in preprocessing?

The following seems to work without an additional step if you download the pbf instead of the bz2 file.

OVERPASS_PLANET_PREPROCESS=mv db/planet.osm.bz2 db/planet2.osm.pbf && osmium tags-filter /db/planet2.osm.pbf nw/highway -o /db/planet.osm.bz2 && rm /db/planet2.osm.pbf

jata1 commented 5 months ago

You @wiktorn have been great so thanks so much for all the help and patience with me over the last few days. I know enough to be dangerous now :-)

wiktorn commented 5 months ago

Yes, you can combine tags-filter with format change in one command as you did.