当前位置:网站首页>How to publish OSM maps locally and customize the mapping
How to publish OSM maps locally and customize the mapping
2022-06-12 23:43:00 【GIS weapon warehouse】
List of articles
1、 origin
- OpenStreetMap( abbreviation OSM) Not only can you use it online for free , And it's free download Raw data , The data format is
.osm.pbf
andshp
. - We will OSM Download the raw data , Treat it as a vector tile , Publish as a service , Can be realized OSM Local map publishing and custom mapping .
- OSM How data is organized , It's a click 、 Line 、 Face to face , It's not the way we usually follow the road 、 building 、 The way rivers divide layers , But it can be extracted according to the attributes .
- openmaptiles A set of OSM A complete solution to data usage , Can achieve OSM Data download 、 Put in storage 、 analysis 、 Generating vector tiles 、 Adjust the map style 、 The full range of map preview features , also Open source .
- Next, let's introduce in detail
openmaptiles
How to install and get started with open source libraries .
2、 Prepare the environment
- install linux System (
openmaptiles
Open source libraries can only be found in linux Running on the system ) - install docker
- install Docker Compose
- install git
2.1、 install linux System
- I installed it on a virtual machine , Virtual machine and linux System installation tutorial reference :https://blog.csdn.net/null_of_error/article/details/108133241
- Virtual machine version I used VM14, Baidu online disk download address :https://pan.baidu.com/s/1BTjByB6oTz8cTxOv_GzGWw, Extraction code :kshr, Including license .
- linux The system I use is centOS7.9, Alicloud official image download address :http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-Everything-2009.iso
2.2、 install docker
Installation tutorial reference :https://www.runoob.com/docker/centos-docker-install.html
I use manual installation , Installation steps :
install docker
yum install -y yum-utils device-mapper-persistent-data lvm2
Set the image source of domestic Alibaba cloud , It's going to be faster than the official
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
install Docker Engine-Community
yum install docker-ce docker-ce-cli containerd.io
start-up docker
systemctl start docker
Test for correct installation
docker run hello-world
2.3、 install Docker Compose
Installation tutorial reference :https://www.runoob.com/docker/docker-compose.html
Installation steps :
install docker compose
curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Set the permissions
chmod +x /usr/local/bin/docker-compose
- Test for correct installation
docker-compose --version
2.4、 install git
Installation tutorial reference :https://www.jianshu.com/p/e6ecd86397fb
Installation steps :
install
yum install git
Test for correct installation
git --version
3、 Publish maps
openmaptiles Open source library
- github Address :https://github.com/openmaptiles/openmaptiles
- Quick start documentation :https://github.com/openmaptiles/openmaptiles/blob/master/QUICKSTART.md
3.1、 Pull the code
Pull openmaptiles Code
git clone https://github.com/openmaptiles/openmaptiles.git
After pulling , Entry directory
cd openmaptiles
perform make command
make
3.2、 Test network
First test whether your computer can open this website :https://www.wikidata.org/,openmaptiles You need to download it from this website poi data , If you can't access , Just follow the steps below to set up , Let the program skip this step . The follow-up wants poi Data. , You can go over the wall by yourself .
How to skip downloading poi data :
Use vi open quickstart.sh file ,vi For usage, please refer to :https://zhuanlan.zhihu.com/p/37704677
vi quickstart.sh
find make import-wikidata That's ok
Input
i
Enter insertion modestay make import-wikidata Enter before the command # Number , Then press
esc
keyInput
:wq
Save and exit
3.3、 Processing data
Execute the following quick start command , The program will run automatically OSM Data download 、 Put in storage 、 analysis 、 The work of generating vector tiles . The default is the region of Albania , The level of tile generation is 0-7 level . We'll talk about how to set up regions and levels later . This command will take a little longer to execute , Wait patiently .
./quickstart.sh
3.4、 Publishing vector tile service
After data processing , Publish the generated vector tiles to map service , step :
Start the service
make start-tileserver
Enter the virtual machine in your computer browser ip Address plus port 8080, My computer address is
http://192.168.50.8:8080/
Click on view Button , See the effect
3.5、 Custom map style
start-up maputnik
make start-maputnik
Enter the virtual machine in your computer browser ip Address plus port 8088, My computer address is
http://192.168.50.8:8088/
Just started TileServer-GL In the web page , Click TileJSON link , Then copy the address
go back to maputnik Webpage , Click the button in the blue box below Data Sources, Paste the above address into the green box , Then click the delete button in the red box , Close other maps . Close the pop-up , You can see the map we've released .
Then you can freely customize the map style
3.6、 Be careful
This is the map of China , See all supported regions
./quickstart.sh china
It is suggested to use the default Albania area for the first time to see the effect , Get familiar with the process , Because its data is small , It's fast . China will be a long time , There's no progress bar , The first test used this big , It's very easy to lose patience .
The factors that determine data processing time : Computer network speed 、 Computer performance 、 The size of the processing data 、 The level of tile generation .
The virtual machine configuration of my computer is relatively low , Dealing with the region of Albania ,0-7 Level data , Probably used 10 About minutes , Processing Taiwan data , Etc. 1 I haven't finished for an hour , Finally gave up , Wait for a good computer and try again .
People who want a national map need to pay attention to , The data for China and Taiwan are separate , It needs to be downloaded and processed separately .
The cut map level is in
.env
Configuration in file
4、 summary
This article introduces in detail
openmaptiles
Open source library installation and quick start useEnter the following help command , You can see
openmaptiles
More features supported , We will write a detailed introduction tomake help
Original address :http://gisarmory.xyz/blog/index.html?blog=OSMVectorTiles
Focus on 《GIS Zeughaus 》 official account , The first time to get more high quality GIS article .
This article adopts Creative Commons signature - Noncommercial use - Share in the same way 4.0 International licensing agreement Licensing . Welcome to reprint 、 Use 、 Re release , But be sure to keep the signature of the article 《GIS Zeughaus 》( Include links : http://gisarmory.xyz/blog/), Not for commercial purposes , Based on this revised work must be released with the same license .
边栏推荐
- 2202-簡曆制作
- Case sharing of online real queuing system reconfiguration -- practical part
- 实战 | UI 自动化测试框架设计与 PageObject 改造
- [opencv learning] small ticket recognition based on perspective transformation and OCR recognition
- 你真的会用PostGIS中的buffer缓冲吗?
- Lower interest rates lead to higher bond prices
- dict和set的基本操作
- Gradient accumulation in pytorch [during the experiment, due to the limitation of GPU video memory, the batch\u size can no longer be increased. To solve this problem, the gradient accumulation method
- 如何实现OSM地图本地发布并自定义配图
- 度量学习(Metric Learning)【AMSoftmax、Arcface】
猜你喜欢
妙才周刊 - 5
LeetCode 146. LRU cache
CST learning: four element array design of circular patch antenna (II) array formation and combination results
2022年电工(初级)操作证考试题库及在线模拟考试
Introduction to message oriented middleware (message queue)
Don't write about the full screen explosion, try the decorator mode, this is the elegant way!!
QT actual combat case (38) -- using qpprocess class to realize the function of starting process
How to package a colorpicker component for color selection?
Chapter 8 - shared model JUC
应用最广泛的动态路由协议:OSPF
随机推荐
SAP UI5 如何通过 manifest.json 文件定义第三方库依赖关系
Common message oriented middleware selection
M_ 8: Design a MySQL table for message queue to store message data
How about opening a securities account in flush? Is it safe or not
Cherry Blossom powder Dudu
2022年G3锅炉水处理考题模拟考试平台操作
Model over fitting - solution (II): dropout
Restrictions on MySQL function creation
House raiding 2
人脸检测:MTCNN
2022起重机械指挥上岗证题目模拟考试平台操作
Leetcode 2164. 对奇偶下标分别排序(可以,一次过)
支持Canvas的Leaflet.Path.DashFlow动态流向线
度量学习(Metric Learning)【AMSoftmax、Arcface】
深度学习-神经网络:卷积的实现方法【直接法(精度没损失)、GEMM(矩阵乘法,精度没损失)、FFT(傅里叶变换,精度有损失)、Winograd(精度有损失)】
Hongmeng starts 2
KConfig
Save state when viewpager is used with fragment fragmentpageradapter
Case sharing of online real queuing system reconfiguration -- practical part
Redis实现短信验证码登录