博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
OpenStreetMap初探(外一篇)——Serving Tiles
阅读量:4032 次
发布时间:2019-05-24

本文共 2738 字,大约阅读时间需要 9 分钟。

Tiles from a third-party provider are the simplest way to make the switch to OpenStreetMap, and offer clarity of cost. However, if you’d like to take full control of your destiny, you can render and serve your own tiles. This section explains how.

Is it for you?

Both generating and serving tiles incur significant hardware requirements, especially if you need global coverage and regular updates.

If you are setting up your own tile server, we recommend that you use .

The options

System requirements

Serving your own maps is a fairly intensive task. Depending on the size of the area you’re interested in serving and the traffic you expect the system requirements will vary. In general, requirements will range from 10-20GB of storage, 4GB of memory, and a modern dual-core processor for a city-sized region to 300GB+ of fast storage, 24GB of memory, and a quad-core processor for the entire planet.

We would recommend that you begin with extracts of OpenStreetMap data – for example, a city, county or small country – rather than spending a week importing the whole world (planet.osm) and then having to restart because of a configuration mistake! You can download extracts from:

  •  (countries and provinces)
  •  (city areas)

The toolchain

We use a series of tools for generating and serving map tiles.

Apache provides the front end server that handles requests from your web browser and passes the request to mod_tile. The Apache web server can also be used to serve static web content like the HTML, JavaScript, or CSS for your map webpage.

Once Apache handles the request from the web user, it passes the request to mod_tile to deal with. Mod_tile checks if the tile has already been created and is ready for use or whether it needs to be updated due to not being in the cache already. If it is already available and doesn’t need to be rendered, then it immediately sends the tile back to the client. If it does need to be rendered, then it will add it to a “render request” queue, and when it gets to the top of the queue, a tile renderer will render it and send the tile back to the client.

We use a tool called Mapnik to render tiles. It pulls requests from the work queue as fast as possible, extracts data from various data sources according to the style information, and renders the tile. This tile is passed back to the client and moves on to the next item in the queue.

For rendering, OpenStreetMap data is stored in a PostgreSQL database created by a tool calledosm2pgsql. These two pieces work together to allow efficient access to the OpenStreetMap geographic data. It is possible to keep the data in the PostgreSQL database up to date using a stream of diff files produced every 60 seconds on the main OpenStreetMap server.

转自:

转载地址:http://bzrbi.baihongyu.com/

你可能感兴趣的文章
消息中间件:谈一谈 RocketMQ 的技术架构
查看>>
微服务统一认证,OAuth2 的认证流程
查看>>
Dubbo性能有多强,来看下官方的性能测试报告
查看>>
Kafka的常用使用场景:从初级到高级,你用到了几个
查看>>
阿里技术团队推荐:Dubbo 服务化最佳实践
查看>>
Nginx 限流常用模块:限制并发和IP访问频率
查看>>
OpenResty 高性能服务器,单机可达10K
查看>>
RocketMQ的十二个特性,你都知道吗「上」
查看>>
RocketMQ的十二个特性,你都知道吗「下」
查看>>
一文搞懂RocketMQ最常见的16个基本概念
查看>>
Intellij IDEA启动优化,让开发的感觉飞起来
查看>>
玩转Java高并发?请先说明下并发下的惊群效应
查看>>
轻松搭建Redis 5.0集群环境,只需十分钟
查看>>
Jmeter压测错误,Address already in use: connect
查看>>
高并发API网关,Spring Cloud Gateway 之限流操作
查看>>
OAuth2.0 微服务认证授权,四种常见的授权模式
查看>>
Java 2019 面试宝典
查看>>
Redis面试题之持久化和五种部署方式
查看>>
搞定Spring Cloud断路器组件 Hystrix 的舱壁模式
查看>>
mybatis之大于、小于、大于等于和小于等于的写法
查看>>