An open API service indexing awesome lists of open source software.

https://github.com/mnvoh/openstreetmap-docker

OpenStreetMap tile server using docker compose.
https://github.com/mnvoh/openstreetmap-docker

docker docker-compose openstreetmap openstreetmap-data openstreetmap-renderer postgis tile-server

Last synced: 3 months ago
JSON representation

OpenStreetMap tile server using docker compose.

Awesome Lists containing this project

README

          

# Setup Guide

## Docker
- [Install and configure docker](https://docs.docker.com/install/)
- Clone this repository

```bash
git clone https://github.com/mnvoh/OpenStreetMap-Docker.git
```
- Change directory to the docker project

```bash
cd OpenStreetMap-Docker
```

- Make a copy of `.env.sample` to `.env` and optionally customize the values

```bash
cp .env.sample .env
```

- Build the images

```bash
docker-compose build
```

- Obtain the OSM data, either the planet or a region of your choice and put it in the `data` directory as `import.osm.pbf`

```bash
wget -O web/data/import.osm.pbf http://download.geofabrik.de/asia/iran-latest.osm.pbf
```

- Run it!

```bash
docker-compose up
```

After you made sure that everything's working, you can daemonize it: `docker-compose up -d`

Also if you wanna have a much faster startup, remove `import.osm.pbf` so that it's not imported again on the next run.

## Access maps on a domain

Out of the box, there's very simple html file with [Leaflet](https://leafletjs.com/) setup. All you need to do is open it and change the used domains. For example change:

```js
var osmUrl='http://maps{s}.nozary.com/hot/{z}/{x}/{y}.png';
```

To:

```js
var osmUrl='http://{s}.maps.your-domain.tld/hot/{z}/{x}/{y}.png';
```

How the subdomains should be set depends on how you've set your DNS records and web server configurations. In this case I've set it to use `mapsa.nozary.com`, `mapsb.nozary.com`, so on and so forth. Although `a.maps.your-domain.com` seems to be more appealing.

## Web Server Configuration

Whether you're using Apache or Nginx, all you have to do is setup a simple reverse proxy. Here are example configurations for both web servers.

### Apache
```apache

ServerName maps.nozary.com
ServerAlias a.maps.nozary.com b.maps.nozary.com c.maps.nozary.com

Allow from localhost

ProxyPass / http://localhost:8080/

```

### Nginx
```nginx
server {
listen 80;
server_name: maps.nozary.com a.maps.nozary.com b.maps.nozary.com c.maps.nozary.com
location / {
proxy_pass http://localhost:8080
}
}
```

# Roadmap

- [ ] Geocoding using [Nominatim](https://github.com/openstreetmap/Nominatim)

Pull Requests are welcome.