当前位置:网站首页>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.pbfandshp. - 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
openmaptilesHow to install and get started with open source libraries .
2、 Prepare the environment
- install linux System (
openmaptilesOpen 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 lvm2Set 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.repoinstall Docker Engine-Community
yum install docker-ce docker-ce-cli containerd.iostart-up docker
systemctl start dockerTest 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-composeSet 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 gitTest 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.gitAfter pulling , Entry directory
cd openmaptilesperform 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.shfind make import-wikidata That's ok

Input
iEnter insertion modestay make import-wikidata Enter before the command # Number , Then press
esckeyInput
:wqSave 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-tileserverEnter 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-maputnikEnter 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 chinaIt 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
.envConfiguration in file
4、 summary
This article introduces in detail
openmaptilesOpen source library installation and quick start useEnter the following help command , You can see
openmaptilesMore 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 .
边栏推荐
- Sequence maximum return
- 2022年R2移动式压力容器充装考试题及在线模拟考试
- Abstract methods and abstract classes
- Examination questions and online simulation examination for safety management personnel of hazardous chemical business units in 2022
- 线上真实排队系统重构案例分享——实战篇
- Theory + practice will help you master the dynamic programming method
- 2202 - production de CV
- QT actual combat case (38) -- using qpprocess class to realize the function of starting process
- 如何实现OSM地图本地发布并自定义配图
- [Yugong series] wechat applet in February 2022 - Reference
猜你喜欢

2202-简历制作

Talent Weekly - 5

Chapter 8 - shared model JUC

Leetcode 2200. 找出数组中的所有 K 近邻下标(可以,一次过)

2202 - production de CV

2022 electrician (elementary) operation certificate examination question bank and online simulation examination

Shardingsphere-proxy-5.0.0 deployment table implementation (I)

Running of NCF dapr application instance

Enterprise wechat H5_ Authentication, H5 application web page authorization login to obtain identity

Ast, really fragrant
随机推荐
Examination questions and online simulation examination for safety management personnel of hazardous chemical business units in 2022
Preparing for the Blue Bridge Cup Day11__ Basic operation of serial port communication
Mgr and greatsql resource summary
启牛帮开通的股票账户是安全可信的吗?
[redis sentinel] failed listening on port 26379 (TCP) & sentinel mode no response problem solved
Message queue directory
Start blogging
InfoQ geek media's 15th anniversary solicitation | brief introduction to the four challenges of building a micro service architecture
2202 resume making
The programmer has worked for 7 years. At the age of 31, he has no choice but to deliver takeout. I really don't want you to go through his journey again
For product managers, which of the two certificates, PMP and NPDP, is more authoritative?
MySQL row to column, column to row, multiple columns to one row, one row to multiple columns
[recommended collection] easy to understand graphic network knowledge - Part 1
Colab tutorial (super detailed version) and colab pro/colab pro+ usage evaluation
[SciPy optimization tutorial] v. quick solution of univariate function optimization
OSM地图本地发布-如何生成各省市矢量地图
Shardingsphere-proxy-5.0.0 deployment table implementation (I)
2022年危险化学品经营单位安全管理人员考试试题及在线模拟考试
模型过拟合-解决方案(二):Dropout
线上真实排队系统重构案例分享——实战篇