当前位置:网站首页>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 .
边栏推荐
- Comprehensive analysis of C array
- 支持Canvas的Leaflet.Path.DashFlow动态流向线
- Start blogging
- For product managers, which of the two certificates, PMP and NPDP, is more authoritative?
- Redis实现短信验证码登录
- Using baserecyclerviewadapterhelper to implement tree structure
- 2022 operation of simulated examination platform for hoisting machinery command certificate
- 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)
- MySQL row to column, column to row, multiple columns to one row, one row to multiple columns
- Access static variables within class in swift
猜你喜欢

2202 - production de CV

你真的会用PostGIS中的buffer缓冲吗?

Running of NCF dapr application instance

妙才周刊 - 5

CST learning: four element array design of circular patch antenna (III) array formation and parallel excitation

2022年R2移动式压力容器充装考试题及在线模拟考试

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

设计消息队列存储消息数据的 MySQL 表格

Access static variables within class in swift

Ast, really fragrant
随机推荐
2022起重机械指挥上岗证题目模拟考试平台操作
Access static variables within class in swift
array
InfoQ 极客传媒 15 周年庆征文|简述构建微服务架构的四大挑战
The Milvus graphical management tool Attu is coming!
同花顺开证券账户怎么样?到底安不安全呢
Save state when viewpager is used with fragment fragmentpageradapter
线上真实排队系统重构案例分享——实战篇
H5时代leaflet中还在用DivIcon?
2022 electrician (elementary) operation certificate examination question bank and online simulation examination
Actual combat | inductance element positioning -- detailed explanation of Halcon and opencv implementation (with source code)
Lower interest rates lead to higher bond prices
Modify the text color of the menu on the right of toobar
Sequence maximum return
[SciPy optimization tutorial] v. quick solution of univariate function optimization
[kubernetes guide ④] pod quick start
scala中的隐式转换和隐式参数讲解与实践
Detr (detection with transformers) learning notes
Restrictions on MySQL function creation
leaflet如何优雅的展示重叠点位的气泡窗口