Skip to content

Commit

Permalink
Add GPS location plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Jun 25, 2024
1 parent 8f301b1 commit 28213a7
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions coreplugins/gpslocation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .plugin import *
Empty file.
13 changes: 13 additions & 0 deletions coreplugins/gpslocation/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "GPS Location",
"webodmMinVersion": "0.5.0",
"description": "Add a GPS location button to the 2D map view",
"version": "1.0.0",
"author": "Piero Toffanin",
"email": "[email protected]",
"repository": "https://github.com/OpenDroneMap/WebODM",
"tags": ["gps", "location"],
"homepage": "https://github.com/OpenDroneMap/WebODM",
"experimental": false,
"deprecated": false
}
5 changes: 5 additions & 0 deletions coreplugins/gpslocation/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from app.plugins import PluginBase

class Plugin(PluginBase):
def include_js_files(self):
return ['main.js']
21 changes: 21 additions & 0 deletions coreplugins/gpslocation/public/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
PluginsAPI.Map.willAddControls([
'gpslocation/node_modules/leaflet.locatecontrol/dist/L.Control.Locate.min.js',
'gpslocation/node_modules/leaflet.locatecontrol/dist/L.Control.Locate.min.css'
], function(args, _){

// TODO: how to specify consistent plugin render ordering?
// we use a timeout to make sure this button is rendered last
// but a better method is warranted
setTimeout(function(){
L.control.locate({
position: 'bottomleft',
showPopup: false,
locateOptions: {
enableHighAccuracy: true
},
strings: {
title: "Show My Location"
}
}).addTo(args.map);
}, 150);
});
14 changes: 14 additions & 0 deletions coreplugins/gpslocation/public/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "gpslocation",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"leaflet.locatecontrol": "^0.81.1"
}
}

0 comments on commit 28213a7

Please sign in to comment.