Skip to content

Commit

Permalink
add mappilary action enricofer/go2mapillary#20
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Oct 14, 2018
1 parent 81ac240 commit f7f220b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
24 changes: 23 additions & 1 deletion core/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions mapFeatures.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
"works",
"yes"
],
"mapillary": [],
"natural": [
"bay",
"beach",
Expand Down
5 changes: 5 additions & 0 deletions resources/mapillary_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f7f220b

Please sign in to comment.