Maps have a decent role in visualizing movement, activities, culture etc.
But using a map for your application is always lead to taking subscriptions or spending huge money altogether. Open street map offline future is very hand in such situations. Let's see how to deploy an open street map API in your system using docker.
Pre-requisites: a piece of basic knowledge in docker
Let's deploy one.
First, we have to download the portion of the map we want to deploy ( you can download the entire map if you wish but here I am using a chunk from it.)
First, we need to create a folder in our system so that we can save the map (represented as a number of tiles) into that.
Step 1:
// Creating a volume and naming it "openstreetmap-data"
docker volume create openstreetmap-data
Step 2:
//Next download the map from geofabrik.de, I downloaded a map of India.
//for that download map data such as india-latest.osm.pbf and extract from geofabrik.de
// let's install it and render that downloaded tiles into the API
docker run \
-v /home/deployer/india-latest.osm.pbf:/data.osm.pbf \
-v openstreetmap-data:/var/lib/postgresql/12/main \
overv/openstreetmap-tile-server \
import
Step 3:
//, let's preserve the rendered data so that next time you can get it from the preserved rather than // rendering it again. Create a volume for rendered tiles and load from that later
docker volume create openstreetmap-rendered-tiles
Step 4:
Run Open Street Map api
docker run \
-p 8081:80 \
-e ALLOW_CORS=enabled \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-rendered-tiles:/var/lib/mod_tile \
-d overv/openstreetmap-tile-server \
run
Additionals
--------------
give option "-e UPDATES=enabled \" to enable automatic update
give option "-e THREADS=24 \" to use 24 threads, default is 4
give option "-e "OSM2PGSQL_EXTRA_ARGS=-C 4096" \" to increase RAM cache to 4 GB,default is 800 MB
give option "-e ALLOW_CORS=enabled \" to retrieve tiles from other domain
അഭിപ്രായങ്ങള്
ഒരു അഭിപ്രായം പോസ്റ്റ് ചെയ്യൂ