Skip to content

Commit

Permalink
python API to open a user specified mapillary keyview
Browse files Browse the repository at this point in the history
  • Loading branch information
enricofer committed Oct 30, 2018
1 parent 56996ef commit fdd5bab
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ The last three items on the right of plugin menu activate one of the mutually ex
- Compare mode: This mode activate the compare component showing the diffences between a background and a foreground images moving a slider widget on the bottom of the dialog. When activated the current image become the foreground image, visible pulling the slider to the right and located on map canvas with the blue marker. The background images to be compared in the dialog could be selected with further mouse click over mapillary coverage, are visible pulling the slider to the right and located on the map with the red marker.
- Markers mode: the markers mode allows to point and click in perspective in the current image and create geolocated markers. Dragging the mouse cursor over the image appears the digitizing cursor over the map canvas showing the corrected location of the image (see [changesets](https://www.mapillary.com/developer/api-documentation/#changesets)), the dragging cursor reprojected over the map and the line of sight axis. Clicking on image dialog the marker become visible, is stored on mapillary samples layer and can be related with categorized annotations. Once created, markers can be further dragged, edited or deleted to adjust or correct related informations.

### Python API
You can use this Python snippet to open the dock viewer and load a specific Mapillary ID image:
```python
from qgis.utils import plugins
if 'go2mapillary' in plugins:
plugins['go2mapillary'].viewer.open('ub0cIhoZ7apeuyidB5qyyw')
```

Zoom Mode:
![main dialog](./docs/04_zoomInOut.gif)

Expand All @@ -69,4 +77,3 @@ Compare Mode:

Markers Mode:
![main dialog](./docs/04_markersCreateDrag.gif)

14 changes: 13 additions & 1 deletion mapillary_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,19 @@ def __init__(self, parentInstance):
def registerJS(self):
self.viewport.page().mainFrame().addToJavaScriptWindowObject("QgisConnection", self)


def open(self, key):
"""
API Dedicated method to open a user specified mapillary_key:
from qgis.utils import plugins
if 'go2mapillary' in plugins:
plugins['go2mapillary'].viewer.open('ub0cIhoZ7apeuyidB5qyyw')
"""
status = self.parentInstance.mainAction.isChecked()
self.parentInstance.dockwidget.show()
self.parentInstance.mainAction.setChecked(status)
self.openLocation(key)

def openLocation(self, key):
if not self.locationKey:
Expand Down

0 comments on commit fdd5bab

Please sign in to comment.