-
Notifications
You must be signed in to change notification settings - Fork 1
Home
- https://boundingbox.klokantech.com/
- https://maputnik.github.io/editor/#0.81/0/0
- test page https://test.housesigma.com/.well-known/mapbox/reed.html?style=https://ovh06.fangintel.com/styles/basic-preview/style.json
Bbox
BC to ON, partial QC
-137.63,41.73,-72.94,60.1
-
Generating your own OpenMapTiles https://www.youtube.com/watch?v=ToAKyADwCwY
-
Maputnik - Edit local Style JSON https://www.youtube.com/watch?v=vCFsrwocE9s
-
https://github.com/housesigma/openmaptiles/blob/master/QUICKSTART.md
- https://github.com/openmaptiles/fonts
- "glyphs": "http://fonts.openmaptiles.org/{fontstack}/{range}.pbf",
Test:
ovh06:~/hsmaptiles# git pull
ovh06:~/hsmaptiles# ./quickstart.sh Toronto
ovh06:~/hsmaptiles# make start-tileserver
build map (quick)
./quickstart.sh ontario
make help
==============================================================================
OpenMapTiles https://github.com/openmaptiles/openmaptiles
Hints for testing areas
make list-geofabrik # list actual geofabrik OSM extracts for download -> <<your-area>>
./quickstart.sh <<your-area>> # example: ./quickstart.sh madagascar
Hints for designers:
make start-maputnik # start Maputnik Editor + dynamic tile server [ see http://localhost:8088 ]
make start-postserve # start dynamic tile server [ see http://localhost:8090 ]
make start-tileserver # start maptiler/tileserver-gl [ see http://localhost:8080 ]
Hints for developers:
make # build source code
make list-geofabrik # list actual geofabrik OSM extracts for download
make list-bbbike # list actual BBBike OSM extracts for download
make download area=albania # download OSM data from any source and create config file
make download-geofabrik area=albania # download OSM data from geofabrik.de and create config file
make download-osmfr area=asia/qatar # download OSM data from openstreetmap.fr and create config file
make download-bbbike area=Amsterdam # download OSM data from bbbike.org and create config file
make generate-bbox-file # compute bounding box of a data file and store it in a file
make psql # start PostgreSQL console
make psql-list-tables # list all PostgreSQL tables
make vacuum-db # PostgreSQL: VACUUM ANALYZE
make analyze-db # PostgreSQL: ANALYZE
make generate-qa # statistics for a given layer's field
make generate-devdoc # generate devdoc including graphs for all layers [./layers/...]
make bash # start openmaptiles-tools /bin/bash terminal
make destroy-db # remove docker containers and PostgreSQL data volume
make start-db # start PostgreSQL, creating it if it doesn't exist
make start-db-preloaded # start PostgreSQL, creating data-prepopulated one if it doesn't exist
make stop-db # stop PostgreSQL database without destroying the data
make clean-unnecessary-docker # clean unnecessary docker image(s) and container(s)
make refresh-docker-images # refresh openmaptiles docker images from Docker HUB
make remove-docker-images # remove openmaptiles docker images
make list-views # list PostgreSQL public schema views
make list-tables # list PostgreSQL public schema tables
cat .env # list PG database and MIN_ZOOM and MAX_ZOOM information
cat quickstart.log # transcript of the last ./quickstart.sh run
make help # help about available commands
==============================================================================
更新docker image
make refresh-docker-images
调整postgres参数
/var/lib/docker/volumes/hsmaptilesbuild_pgdata/_data/postgresql.conf
另一个办法: https://gist.github.com/smellman/559f74158447c60ebc88c8bc12ebb505
# https://pgtune.leopard.in.ua/#/
# DB Version: 9.6
# OS Type: linux
# DB Type: web
# Total Memory (RAM): 96 GB
# CPUs num: 32
# Data Storage: hdd
max_connections = 200
shared_buffers = 24GB
effective_cache_size = 72GB
maintenance_work_mem = 2GB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 4
effective_io_concurrency = 2
work_mem = 31457kB
min_wal_size = 1GB
max_wal_size = 4GB
max_worker_processes = 32
max_parallel_workers_per_gather = 4
启动停止postgres sql docker。
make start-db
make stop-db
导入数据。
make import-data
make download area=north-america
# 修改 .env BBOX
BBOX=-134.42,40.2,-51.11,57.98
Delete the ./data/<area>.bbox file
# area 就是osm.pbf下载文件的名字。
make import-osm area=north-america
make import-borders area=north-america
make import-wikidata area=north-america
Each time changed SQL for layer
make clean
make
make import-sql
# one line
make clean && make && make import-sql
generate vector tile
make generate-bbox-file area=north-america # compute data bbox -- not needed for the whole planet
make generate-tiles area=north-america # generate tiles
cp data/tiles.mbtiles server/Toronto.mbtiles
tileserver-gl only
docker run --rm --user=0:0 -it --name tileserver-gl -v $(pwd)/server:/data -p 8080:8080 maptiler/tileserver-gl --port 8080 --verbose
# run in background
docker run -d --rm -it -v $(pwd)/server:/data -p 8080:80 maptiler/tileserver-gl --config ./config.json
config.json doc https://tileserver.readthedocs.io/en/latest/config.html?highlight=config
添加地图数据源, 配置 config.json
"data": {
"basemap_bc_on_qc_ny_mi": {
"mbtiles": "BC_ON_QC_NY_MI.mbtiles"
}
...
}
修改地图样式 style.json
,修改 openmaptiles 数据源为新添加的数据源id
"sources": {
"openmaptiles": {
"type": "vector",
"url": "mbtiles://{basemap_bc_on_qc_ny_mi}"
},
...
}
保存后重启即可
cd ~/mbtiles
# 清空当前正在运行的所有 docker 服务
docker stop $(docker ps -aq) && docker rm $(docker ps -aq)
# 重新启动地图服务
docker run -d --restart=always -it -v $(pwd):/data -p 8080:80 maptiler/tileserver-gl --config ./config.json
配置地块数据源
"data": {
"properties": {
"mbtiles": "properties-toronto.mbtiles"
}
}
在 style.json
中添加地块 source
"sources": {
...
"properties": {
"type": "vector",
"url": "mbtiles://{properties}"
}
},
使用 mbtiles 查看工具,比如 sqlitebrowser, 查看当前地块的 layerId
使用 Maputnik 编辑 style.json
, 添加地块的layer, layerId 为 PROPERTY_BOUNDARIES_WGS84
也可以直接把下面的json 添加到 style.json
的 layers 数组中
"version": 8,
"name": "Maptiler Street V2",
"metadata": {
"mapbox:type": "template"
},
"sources": {
"openmaptiles": {
"type": "vector",
"url": "mbtiles://{basemap_bc_on_qc_ny_mi}"
},
"properties": {
"type": "vector",
"url": "mbtiles://{properties}"
}
},
"layers": [
...
{
"id": "properties_range",
"type": "line",
"source": "properties",
"source-layer": "PROPERTY_BOUNDARIES_WGS84",
"minzoom": 18,
"paint": {
"line-color": "rgba(111, 111, 111, 1)"
}
}
]
最后将 style.json
导出,并上传到服务器,重启 docker 容器即可