diff --git a/core/actions.py b/core/actions.py index dea1b0a9..f73b5562 100644 --- a/core/actions.py +++ b/core/actions.py @@ -25,7 +25,7 @@ from qgis.PyQt.QtCore import QUrl from qgis.PyQt.QtGui import QDesktopServices from qgis.core import Qgis, QgsAction -from qgis.utils import iface +from qgis.utils import iface, plugins ACTIONS_PATH = 'from QuickOSM.core.actions import Actions;' ACTIONS_VISIBILITY = ['Canvas', 'Feature', 'Field'] @@ -55,6 +55,19 @@ def add_actions(layer, keys): ) actions.addAction(osm_browser) + title = 'Mapillary' + mapillary = QgsAction( + QgsAction.GenericPython, + title, + ACTIONS_PATH + 'Actions.run("mapillary","[% "mapillary" %]")', + resources_path('mapillary_logo.svg'), + False, + title, + ACTIONS_VISIBILITY, + '' + ) + actions.addAction(mapillary) + title = 'JOSM' josm = QgsAction( QgsAction.GenericPython, @@ -165,6 +178,15 @@ def run(field, value): var.openUrl(QUrl(url)) + elif field == 'mapillary': + if 'go2mapillary' in plugins: + plugins['go2mapillary'].dockwidget.show() + plugins['go2mapillary'].viewer.openLocation(value) + else: + var = QDesktopServices() + url = 'https://www.mapillary.com/map/im/' + value + var.openUrl(QUrl(url)) + elif field == 'josm': import urllib.request, urllib.error, urllib.parse try: diff --git a/mapFeatures.json b/mapFeatures.json index 790648e7..b568f29f 100644 --- a/mapFeatures.json +++ b/mapFeatures.json @@ -300,6 +300,7 @@ "works", "yes" ], + "mapillary": [], "natural": [ "bay", "beach", diff --git a/resources/mapillary_logo.svg b/resources/mapillary_logo.svg new file mode 100644 index 00000000..a11b2b70 --- /dev/null +++ b/resources/mapillary_logo.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file