コンテンツにスキップ

外部ルーティング

現地で地物の一つまでの旅程を計算するのに便利です。 QGISの属性フォームを簡単に設定することで、現場での作業時にハイパーリンクを介してGoogleマップのナビゲーションツールに素早くアクセスすることができます。

QGISで属性フォームウィジェットを設定する

デスクトップの準備

以下は、点レイヤーの地物へのナビゲーションの例です。

Create a new field in your data table (datatype text). In the attribute form settings, select "attachment" as widget type. Tick "Display a hyperlink for document path (read-only)". Then enter the following expression as default value:

concat(
  'https://www.google.com/maps/dir/?api=1&destination=',
  y(transform($geometry, layer_property(@layer, 'crs'), 'EPSG:4326')),
  '%2C',
  x(transform($geometry, layer_property(@layer, 'crs'), 'EPSG:4326')),
  '&travelmode=driving'
)

また、ジオメトリを変更した場合に備えて、"更新時にデフォルト値を適用"にチェックを入れます。

Google マップで地物の場所を表示するだけの場合は、次の式を使用できます。

concat( 'https://maps.google.com?q=',
  y(transform($geometry, layer_property(@layer, 'crs'),'EPSG:4326')),
  '%2C',
  x(transform($geometry, layer_property(@layer, 'crs'),'EPSG:4326')),
  '&zoom=19&t=h')

使用方法

フィールドマーク

ナビゲーションが必要な、またはグーグルマップで開きたい地図上の地物をクリックします。属性フォームで、グーグルマップへのリンクをクリックします。