当前位置:网站首页>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 .
边栏推荐
- MySQL row to column, column to row, multiple columns to one row, one row to multiple columns
- Leetcode 2200. 找出数组中的所有 K 近邻下标(可以,一次过)
- Shardingsphere-proxy-5.0.0 deployment table implementation (I)
- Redis realizes SMS verification code login
- C # graphic tutorial (Fourth Edition) chapter7-7.6.1 virtual and override
- Colab tutorial (super detailed version) and colab pro/colab pro+ usage evaluation
- [opencv learning] use the Tesseract OCR movement to recognize numbers
- Deep feature synthesis and genetic feature generation, comparison of two automatic feature generation strategies
- Leetcode 2164. Sort odd and even subscripts separately (yes, once)
- LeetCode 146. LRU cache
猜你喜欢
CV - baseline summary (development history from alexnet to senet)
Tableau
2202 - production de CV
妙才周刊 - 5
测试平台系列(97) 完善执行case部分
移动安全必备之CS呢【NETHUNTER】
CST learning: four element array design of circular patch antenna (II) array formation and combination results
Deep learning neural network: implementation method of convolution [direct method (no loss of precision), GEMM (matrix multiplication, no loss of precision), FFT (Fourier transform, loss of precision)
數組
M_ 8: Design a MySQL table for message queue to store message data
随机推荐
Tsinghua University image source will cause tensorflow GPU installation failure
Preparing for the Blue Bridge Cup Day11__ Basic operation of serial port communication
Leetcode 2200. 找出数组中的所有 K 近邻下标(可以,一次过)
Redis实现短信验证码登录
M_ 8: Design a MySQL table for message queue to store message data
leaflet如何加载10万条数据
Xi'an Jiaotong 22nd autumn e-commerce technology online expansion resources (IV) [standard answer]
Alien skin exposure X7 color filter plug-in, raw post-processing tool
NCF 的Dapr应用实例的运行
Don't write about the full screen explosion, try the decorator mode, this is the elegant way!!
Face detection: mtcnn
Actual combat | inductance element positioning -- detailed explanation of Halcon and opencv implementation (with source code)
Introduction to message oriented middleware (message queue)
Enterprise wechat H5_ Authentication, H5 application web page authorization login to obtain identity
Teach you how to grab ZigBee packets through cc2531 and parse encrypted ZigBee packets
[redis sentinel] failed listening on port 26379 (TCP) & sentinel mode no response problem solved
C language: how to give an alias to a global variable?
利率降低导致债券价格上涨
Using baserecyclerviewadapterhelper to implement tree structure
2022 questions d'examen pour le personnel de gestion de la sécurité de l'unit é de gestion des produits chimiques dangereux et examen de simulation en ligne