1、下载地图pbf文件:
https://planet.openstreetmap.org/
2、nominatim官网
https://nominatim.org/release-docs/latest/admin/Installation/
3、地图文件打包:
docker run -it --shm-size=20g \
-e PBF_PATH=/nominatim/data/china-latest.osm.pbf \
-e REPLICATION_URL=https://download.geofabrik.de/asia/china-updates/ \
-e NOMINATIM_PASSWORD=very_secure_password \
-v /data/earth/nominatim:/nominatim/data \
-v /data/earth/nominatim-psql_data:/var/lib/postgresql/14/main \
-p 8080:8080 \
--name nominatim \
mediagis/nominatim:4.4
4、复制挂载的文件至新服务器,并允许docker
导入
docker run -it --shm-size=20g \
-e PBF_PATH=/nominatim/data/china-latest.osm.pbf \
-e REPLICATION_URL=https://download.geofabrik.de/asia/china-updates/ \
-e NOMINATIM_PASSWORD=very_secure_password \
-v /data/china/nominatim:/nominatim/data \
-v /data/china/nominatim-psql_data:/var/lib/postgresql/14/main \
-p 8080:8080 \
--name nominatim \
mediagis/nominatim:4.4
4、地图检测,测试链接:
http://localhost:8080/search.php?q=china%20beijing
5、安装使用Nominatim UI
https://github.com/osm-search/nominatim-ui/blob/master/README-nominatim-docker.md
步骤如下:
# Log into the running container
docker exec -it nominatim /bin/bash
VERSION=3.4.0
cd /tmp
curl -L --fail -o nominatim-ui.tar.gz https://github.com/osm-search/nominatim-ui/releases/download/v${VERSION}/nominatim-ui-${VERSION}.tar.gz
tar -xzf nominatim-ui.tar.gz && rm nominatim-ui.tar.gz
mv nominatim-ui-$VERSION nominatim-uitee nominatim-ui/dist/theme/config.theme.js << 'EOF'
Nominatim_Config.Nominatim_API_Endpoint = '/';
EOFcd nominatim-ui/dist/ && ln -s index.html search.php && cd -mkdir /nominatim/website/ui
mv nominatim-ui/dist/* /nominatim/website/ui/
rm -r nominatim-ui
chown -R nominatim:nominatim /nominatim/website/ui/
Nominatim UI访问:
http://localhost:8080/ui/search.html?q=%E5%8C%97%E4%BA%AC