How to make your own maps/tiles

本文详细介绍了如何使用Mapnik、PostGIS等工具将OpenStreetMap的osm文件转换为可视化的栅格图像,包括安装配置、数据导入、样式调整及最终渲染流程。

This wiki here describes how to render osm based vector planet.osm files to raster images. Please note we will use china.osm (which is a cut down version of planet.osm) for this wiki, as planet.osm is too huge for everything to be done in a timely manner.

Mapnik on Ubuntu

on ubuntu 12.04 do:

sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:mapnik/v2.0.2
sudo apt-get update && sudo apt-get -y install libmapnik mapnik-utils python-mapnik

Postgis Installation Guide

http://wiki.openstreetmap.org/wiki/Mapnik/PostGIS

on ubuntu 12.04 do: (addc2h2as the user andchinaas the database)

sudo apt-get install -y postgresql-9.1-postgis postgresql-contrib-9.1
sudo -u postgres -i -H
createuser -SdR c2h2
createdb -E UTF8 -O c2h2 china
psql -d china -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
psql -d china -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql

psql china -c "ALTER TABLE geometry_columns OWNER TO c2h2"
psql china -c "ALTER TABLE spatial_ref_sys OWNER TO c2h2"
exit  

edit postgres ACL: (changemd5->trustfor local)

sudo vim /etc/postgresql/9.1/main/pg_hba.conf 
sudo /etc/init.d/postgresql restart 

Install osm2pgsql (the osm -> postgis converting tool)

Strongly recommand to install by using this ppa repo:

sudo add-apt-repository -y ppa:kakrueger/openstreetmap
sudo apt-get update && sudo apt-get install -y osm2pgsql

native apt-get is doable but might have some problems + bugs: (not suggested using below)

fix osm2pgsql bug: (according to:http://lists.openstreetmap.org/pipermail/dev/2011-June/022995.html)

sudo  cp /usr/share/osm2pgsql/default.style /usr/share/

Load maps into postgis

on ubuntu 12.04 do: (note this gonna dl 70mb~ file and take approx 10min to import into postgis)

wget http://download.geofabrik.de/osm/asia/china.osm.pbf && osm2pgsql -d china -U c2h2 --slim -C 2000 china.osm.pbf

Render our tiles with mapnik + python

Now we generate our tiles with 4 theads:

Clone our git: (copied fromhttp://svn.openstreetmap.org/applications/rendering/mapnik/)

git clone git@piza.cc:ntmaps.git
cd ntmaps/mapnik-render
./get-coastlines-192.168.8.25.sh
python generate_xml.py osm.xml c2h2_china.xml  --password '' --host 'localhost' --user 'c2h2' --dbname 'china' --port '5432'
python gen_china_multi.py c2h2_china.xml

wait .... and done!

Other rendering map/tiles

Tile Server Guide (this is AIO package, and not very well tested by author of this wiki)

You will want this if you are building a tile server in one go.

http://switch2osm.org/serving-tiles/building-a-tile-server-from-packages/

Tilestache Guide

https://github.com/migurski/TileStache

guide to install deps:http://obroll.com/install-python-pil-python-image-library-on-ubuntu-11-10-oneiric/

git clone https://github.com/migurski/TileStache.git
sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev python2.7-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib
sudo pip install -U PIL modestmaps simplejson werkzeug
cd TileStashe
python scripts/tilestache-server.py

If you still have problem with PIL

wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
cd Imaging-1.1.7 && python setup.py

Other Map Sources (cut down versions)

Good Reading Sources + Refs

Other Postgress FAQ

TO-READ

<think>我们正在讨论的是OpenSeaMap地图服务。根据引用内容,我们知道OpenSeaMap是一个提供海洋地图数据的项目,它通常作为瓦片地图服务(如https://tiles.openseamap.org)提供。这些瓦片可以被Leaflet或OpenLayers等地图库使用。 用户希望了解https://tiles.openseamap.org地图的相关信息。因此,我们需要介绍OpenSeaMap项目及其提供的瓦片服务。 从引用中我们得知: - 引用[1]提到了OpenSeaMap作为覆盖层(overlay)出现在本地化的OpenStreetMap示例中,基底层是OpenCycleMap。 - 引用[2]解释了Leaflet与OpenStreetMap的关系,同时指出OpenStreetMap数据可以被多种客户端使用。同样,OpenSeaMap的数据也可以被类似的地图库使用。 因此,我们可以推断OpenSeaMap是一个基于OpenStreetMap数据的专题地图,专注于海洋信息(如海深、航道、浮标等)。它的瓦片服务地址为https://tiles.openseamap.org。 下面我们将详细介绍OpenSeaMap和其瓦片服务。 </think>### OpenSeaMap地图介绍及相关信息 OpenSeaMap是一个基于开放数据的全球海洋地图项目,主要提供航海相关的专题地图数据。其瓦片服务地址为`https://tiles.openseamap.org`,以下是关键信息: #### 1. **项目性质与技术架构** - 开源协作项目,采用类似OpenStreetMap的众包模式收集海洋数据 - 使用标准瓦片地图服务(TMS),遵循XYZ瓦片规范 - 数据存储为PNG格式的256×256像素瓦片,支持缩放级别0-18级 #### 2. **地图内容特征** - **核心图层**: - 海图标记(浮标、灯塔、航道) - 等深线和水深数据 - 港口设施和码头信息 - 海洋气象站和潮汐数据 - **特色覆盖**: - 实时船舶AIS定位(需插件支持) - 海底地形渲染 - 海洋保护区标注 #### 3. **技术集成方式** 可通过主流地图库集成: ```javascript // Leaflet集成示例 L.tileLayer('https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', { attribution: '© OpenSeaMap contributors' }).addTo(map); // OpenLayers集成示例 new ol.layer.Tile({ source: new ol.source.XYZ({ url: 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png' }) }) ``` #### 4. **数据来源与许可** - 基础数据来自OpenStreetMap海洋标签(`seamark:*`) - 水深数据整合自IHO海图 - 采用ODbL开放许可,允许商业和非商业使用[^1][^2] #### 5. **适用场景** - 航海导航辅助系统 - 船舶航线规划 - 海洋科考数据可视化 - 水上运动安全监控 > 注:该服务为非营利项目,可能存在瓦片更新延迟(通常季度级更新),建议搭配官方海图使用关键航行场景[^1]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值