Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading http://localhost:80/tile/{z}/{x}/{y}.png or leaflet-demo.html #6

Closed
jevvz opened this issue Aug 27, 2018 · 3 comments
Closed

Comments

@jevvz
Copy link

jevvz commented Aug 27, 2018

Don't know if I'm doing something wrong. Every step seems OK with no errors, until I try to load a map. I can't load http://localhost:80/tile/{z}/{x}/{y}.png and neither leaflet-demo.html.

I downloaded canary-islands-latest.osm.pbf.

Should z x y been replaced with a value? The leaflet-demo.html should be loaded as the following URL: http://localhost:80/tile/leaflet-demo.html or http://localhost:80/leaflet-demo.html (neither one ore the other loads)?

Thank you in advance.

@Istador
Copy link
Contributor

Istador commented Aug 27, 2018

z, y, z is not meant to be manually replaced, but automatically by leaflet (https://leafletjs.com/ - a javascript library loaded within the leaflet-demo.html file). The whole world in one image would be: http://localhost:80/tile/0/0/0.png (zoom level 0).

The leaflet-demo.html file is not inserted into the docker image, so the apache webserver inside the docker container listening at port 80 does not serve the file. It is meant as an example that you can open with your browser on the host machine directly as a file (Right Click > Open with > Firefox/Chrome/...).

The example file can be modified to work with other servers too. For example: if you replace http://localhost:80/tile/{z}/{x}/{y}.png with https://c.tile.openstreetmap.org/{z}/{x}/{y}.png it loads tiles from the OpenStreetMap-Server instead of your local one (don't do that in a productive environment).

@cnaslain
Copy link

  • Get the IP of your running container by running this command (in my case; the IP is 172.17.0.2):
    docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps | grep overv/openstreetmap-tile-server | awk '{print $1}')
  • Modify the leaflet-demo.html (from your git clone location) page with this IP adress:
    L.tileLayer('http://172.17.0.2/tile/{z}/{x}/{y}.png', {
  • Open in your browser your local leaflet page
  • That's it!

@Overv
Copy link
Owner

Overv commented Apr 23, 2019

This has now been clarified in the README.

@Overv Overv closed this as completed Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants