Overv / openstreetmap-tile-server

Docker file for a minimal effort OpenStreetMap tile server
Apache License 2.0
1.22k stars 485 forks source link

Cannot import external PBF file #7

Closed zstadler closed 5 years ago

zstadler commented 6 years ago

Bind mapping of the external PBF file does not work as expected.

The initial log for

docker run -v "/f/temp/myregion.osm.pbf:/data.osm.pbf" -v openstreetmap-data:/var/lib/postgresql/10/main overv/openstreetmap-tile-server import

is:

 * Starting PostgreSQL 10 database server
   ...done.
CREATE EXTENSION
CREATE EXTENSION
ALTER TABLE
ALTER TABLE
WARNING: No import file at /data.osm.pbf, so importing Luxembourg as example...
/data.osm.pbf: Is a directory
osm2pgsql version 0.96.0 (64 bit id space)

Using lua based tag processing pipeline with script /home/renderer/src/openstreetmap-carto/openstreetmap-carto.lua
Using projection SRS 3857 (Spherical Mercator)

The run continues and sucessfully imports the Luxembourg data.

According to the docker documentation

If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory.

This could explain the log line

/data.osm.pbf: Is a directory
Overv commented 6 years ago

I believe that the Docker documentation means that if /f/temp/myregion.osm.pbf does not exist yet, then it will create a directory there. Could you check if the host path is correct and exists by running file /f/temp/myregion.osm.pbf? Also make sure that the host path (on the left of the column) is actually an absolute path.

idrm commented 5 years ago

@zstadler, if you are a Windows user check that the F drive is shared in the Docker settings. I'd also suggest using f:/temp/... (instead of /f/temp/...) in your docker command.

clough360 commented 5 years ago

I am having the same issue as @zstadler If I try and use c:/temp format instead of /c/temp as @idrm suggested, I get Error response from daemon: invalid mode: /data.osm.pbf.

zstadler commented 5 years ago

I'm still not sure about that, but it may be related to the Window's Docker Machine, and therefore all containers, not having access to directories outside of the user's home directory.

Istador commented 5 years ago

Try //f/temp/... instead of /f/temp/....

AshtonIzmev commented 5 years ago

Solved changing the .osm.pbf filepath in run.sh (for example /import) and compiling the docker image again. Then using a custom mount for a folder "-v dl:/import" (assuming data.osm.pbf is in the folder ./dl ) Thanks for the hints

psagun commented 4 years ago

Solved changing the .osm.pbf filepath in run.sh (for example /import) and compiling the docker image again.

Hi, I'm on windows and using docker desktop. The external pbf file of my region is not importing. Everytime I run the import command that Overv provided, it only downloads the example Luxembourg pbf. Could you explain in detail how did you solve it?

zstadler commented 4 years ago

@sagunpandey123,

I found that docker-compose does a much better job in mapping Windows directories to the Docker machine. Create your own docker-compose.yaml file and place all the required docker parameters and volume mapping there. Check out the file syntax here. Then you can work with the docker image/container with docker-compose commands instead of docker.

I'm sorry I cannot help you with this Docker image as I no longer use it

Istador commented 4 years ago

Regarding Windows volume mounts have a look at issues #30 and #8. Regarding docker-compose see issues #18 and #19 for examples.

zsoooc commented 2 years ago

Hi @Istador !

I have a similar issue on Windows 10. I tried with this command:

docker run -v d://osm_tileserver//slovakia.osm.pbf://region.osm.pbf -v map-data://var/lib/postgresql/14/main overv/openstreetmap-tile-server import

WARNING: No import file at /data/region.osm.pbf, so importing Luxembourg as example... INFO: Download PBF file: https://download.geofabrik.de/europe/luxembourg-latest.osm.pbf

What do you think? What is the problem?

zsoooc commented 2 years ago

UPDATE: It works using this command: docker run -v d:\osm_tileserver\slovakia.osm.pbf:/data/region.osm.pbf -v osm-data:/var/lib/postgresql/14/main -v osm-tiles:/data/tiles overv/openstreetmap-tile-server import