外置路径¶
可以方便地计算您在外业某个要素的行程。 通过在QGIS中简单配置属性表单,可以在外业工作时通过超链接快速访问谷歌地图中的导航工具。
在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'
)
如果要对几何图形进行修改,请勾选 "更新时应用默认值"。
If you simply want to show your feature location in Google Maps, you can use the following expression:
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')
用法¶
QField界面
单击地图上想要导航到或在谷歌地图中打开的要素。在属性表单中,单击指向谷歌地图的链接。