暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL openstreetmap 地图数据、路网数据服务 - 高速下载、导入 gis, pgrouting

原创 digoal 2022-01-20
832

作者

digoal

日期

2021-09-08

标签

PostgreSQL , gis , pgrouting , osm , openstreetmap


https://gis.cybertec-postgresql.com/

https://www.cybertec-postgresql.com/en/openstreetmap-service-by-cybertec/

OPENSTREETMAP SERVICE BY CYBERTEC

cybertec 提供的地图和路网数据, 数据源来自openstreetmap, 为什么要提供这个服务? 直接去openstreetmap下载不好吗?

1、openstreetmap下载需要提供经纬度范围, 不适合小白.

2、openstreetmap下载的数据导入比较慢.

cybertec 每天刷新一次osm数据, 同时导入到数据库并以pg_dump格式导出, 以国家为单位提供dump文件的下载, 同时将数据拆分为路网数据和地图数据两部分, 便于用户选择使用.

Dataset frequency

How often will our datasets be generated? Native extracts (pbfs) are generated daily, dumps are produced 1 to 2 times per month. Currently, we’re trying to optimize the whole process to provide current dumps more frequently for our customers.

The general instructions are as follows:

Firstly, start by heading to https://gis.cybertec-postgresql.com/ and choose your region of interest. Figure 2 shows available datasets for Austria at present time. As we want to setup a tiling service, our dataset flavor of choice is “Analysis, Tiling”. Let’s download the latest dump for this region from https://gis.cybertec-postgresql.com/osmtile/europe/austria/osmtile_europe_austria_latest_compressed.dump

Secondly, we must import our dump. How can this be accomplished?
Instructions are published beneath each published dump as readme.txt. For Austria, instructions can be accessed at https://gis.cybertec-postgresql.com/osmtile/europe/austria/readme.txt.

Let’s quickly look at the instructions to better understand how we must proceed. As requirement, a database must be prepared, with extensions PostGIS and hstore enabled.

postgres=# create database tilingdb;  
CREATE DATABASE  
postgres=# \c tilingdb  
psql (13.3 (Ubuntu 13.3-1.pgdg20.04+1), server 13.4 (Ubuntu 13.4-1.pgdg20.04+1))  
You are now connected to database "tilingdb" as user "postgres".  
tilingdb=# create extension postgis;  
CREATE EXTENSION  
tilingdb=# create extension hstore;  
CREATE EXTENSION  
复制

Finally, the dump can be restored by executing

pg_restore -j 4 --no-owner -d tilingdb  
osmtile_europe_austria_latest_compressed.dump  
复制

This results in a new database schema osmtile_europe_austria.

tilingdb=# \dn  
          List of schemas  
                   Name | Owner  
------------------------+----------  
 osmtile_europe_austria | postgres  
 public                 | postgres  
(2 rows)  
复制

The upcoming listing shows generated tables within our schema.

tilingdb=# \dt+ osmtile_europe_austria.  
                                           List of relations  
         Schema         |        Name        | Type  |  Owner   | Persistence |  Size   | Description  
------------------------+--------------------+-------+----------+-------------+---------+-------------  
 osmtile_europe_austria | planet_osm_line    | table | postgres | permanent   | 1195 MB |  
 osmtile_europe_austria | planet_osm_nodes   | table | postgres | permanent   | 3088 MB |  
 osmtile_europe_austria | planet_osm_point   | table | postgres | permanent   | 323 MB  |  
 osmtile_europe_austria | planet_osm_polygon | table | postgres | permanent   | 1865 MB |  
 osmtile_europe_austria | planet_osm_rels    | table | postgres | permanent   | 102 MB  |  
 osmtile_europe_austria | planet_osm_roads   | table | postgres | permanent   | 130 MB  |  
 osmtile_europe_austria | planet_osm_ways    | table | postgres | permanent   | 1996 MB |  
(7 rows)  
复制

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论