aboutsummaryrefslogtreecommitdiff
path: root/app/javascript/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/controllers')
-rw-r--r--app/javascript/controllers/map_controller.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/javascript/controllers/map_controller.js b/app/javascript/controllers/map_controller.js
index 57bafa5..0a64f98 100644
--- a/app/javascript/controllers/map_controller.js
+++ b/app/javascript/controllers/map_controller.js
@@ -19,6 +19,7 @@ import "leaflet.markercluster/dist/leaflet.markercluster.js"
import 'leaflet-extra-markers'
import 'leaflet-easyprint'
+import { GeoSearchControl, OpenStreetMapProvider } from 'leaflet-geosearch';
export default class extends Controller {
static targets = [ "container" ]
@@ -75,6 +76,15 @@ export default class extends Controller {
sizeModes: ['A4Portrait', 'A4Landscape']
}).addTo(this.map);
+ /* Add search */
+ const provider = new OpenStreetMapProvider();
+ const searchControl = new GeoSearchControl({
+ provider: provider,
+ style: 'button',
+ position: 'bottomright'
+ });
+ this.map.addControl(searchControl);
+
// Allow calling the mapController from elsewhere.
this.element[this.identifier] = this
}