ドイツのすべての道路のリストを作成しようとしています(緯度、経度、通りの名前)。
これまで、osm2pgsqlを使用してドイツ語のosmファイルをpostgresデータベースにインポートしました。
ですから、私が探しているのは、すべての道路にクエリを実行できるクエリです。
ドイツのすべての道路のリストを作成しようとしています(緯度、経度、通りの名前)。
これまで、osm2pgsqlを使用してドイツ語のosmファイルをpostgresデータベースにインポートしました。
ですから、私が探しているのは、すべての道路にクエリを実行できるクエリです。
まず、psql
ツールの使用をお勧めします。したがって、データベースがgisと呼ばれていると仮定して、ターミナルで次のコマンドを入力します。
psql gis
psqlツール内からデータベースにクエリを実行できますが、最初にosm2psqlによって作成されたテーブルのアイデアを取得するのはg0odのアイデアです。これは、次のように入力します。
\d
これにより、次のような出力が得られます。
List of relations
Schema | Name | Type | Owner
--------+--------------------+-------+----------
public | geography_columns | view | postgres
public | geometry_columns | table | gis
public | planet_osm_line | table | user
public | planet_osm_nodes | table | user
public | planet_osm_point | table | user
public | planet_osm_polygon | table | user
public | planet_osm_rels | table | user
public | planet_osm_roads | table | user
public | planet_osm_ways | table | user
public | spatial_ref_sys | table | gis
(10 rows)
そこで、planet_osm_roadsで見そうな候補を確認できます。次のように入力します。
\d planet_osm_roads
これにより、道路テーブルの構造が表示され、次のようになります。
Table "public.planet_osm_roads"
Column | Type | Modifiers
--------------------+----------+-----------
osm_id | bigint |
access | text |
addr:housename | text |
addr:housenumber | text |
addr:interpolation | text |
admin_level | text |
aerialway | text |
aeroway | text |
amenity | text |
....
waterway | text |
wetland | text |
width | text |
wood | text |
z_order | integer |
way_area | real |
way | geometry |
そこから、クエリを作成できます。何かのようなもの:
SELECT osm_id,name,way FROM planet_osm_roads LIMIT 1;
リストの最初の道を取得します。http://www.postgresql.org/docs/のドキュメントは、ウェイジオメトリ文字列のデコードに役立ちます。