1- # Vue -mapbox-geocoder
1+ # v -mapbox-geocoder 🌎
22
3- [ Vue -mapbox] ( https://github.com/soal/vue-mapbox ) plugin for [ mapbox-gl-geocoder] ( https://github.com/mapbox/mapbox-gl-geocoder ) support.
3+ [ vue -mapbox] ( https://github.com/soal/vue-mapbox ) plugin for [ mapbox-gl-geocoder] ( https://github.com/mapbox/mapbox-gl-geocoder ) support.
44
55## Usage
66
7- First of all you need to install Mapbox GL and Vue -mapbox. [ See vue-mapbox doc] ( https://soal.github.io/vue-mapbox/#/quickstart )
7+ First of all you need to install Mapbox GL and vue -mapbox. [ See vue-mapbox doc] ( https://soal.github.io/vue-mapbox/#/quickstart )
88
9- Install mabbox-gl-geocoder and vue-mapbox-geocoder:
109
1110``` bash
12- npm i @mapbox/mapbox-gl-geocoder vue-mapbox vue-mapbox-geocoder
11+ # Install mabbox-gl-geocoder and vue-mapbox-geocoder:
12+ $ npm i @mapbox/mapbox-gl-geocoder vue-mapbox @geospoc/v-mapbox-geocoder
1313```
1414
1515Now you can add geocoder control like other controls:
1616
17- ``` vue
17+ ``` html
1818<template >
1919 <MglMap
2020 :accessToken =" accessToken"
2121 :mapStyle =" mapStyle"
2222 >
2323 <MglGeocoderControl
24- <-- props needed for GeolocateControl -->
2524 :accessToken =" accessToken"
2625 :input.sync =" defaultInput"
2726 @results =" handleSearch"
@@ -30,34 +29,28 @@ Now you can add geocoder control like other controls:
3029</template >
3130
3231<script >
33- import {
34- MglMap,
35- MglNavigationControl,
36- MglGeolocateControl
37- } from 'vue-mapbox'
38-
39- import MglGeocoderControl from 'vue-mapbox-geocoder'
40-
41- export default {
42- name: 'App',
43-
44- components: {
45- MglMap,
46- MglGeocoderControl
47- },
48- data() {
49- return {
50- accessToken: 'YOUR_ACCESS_TOKEN',
51- mapStyle: 'YOUR_MAP_STYLE',
52- defaultInput: 'Bodhgaya'
53- }
54- },
55- methods: {
56- handleSearch(event) {
57- console.log(event)
58- }
59- }
60- }
32+ import { MglMap } from ' vue-mapbox' ;
33+ import MglGeocoderControl from ' @geospoc/v-mapbox-geocoder' ;
34+
35+ export default {
36+ name: ' App' ,
37+ components: {
38+ MglMap,
39+ MglGeocoderControl
40+ },
41+ data () {
42+ return {
43+ accessToken: ' YOUR_ACCESS_TOKEN' ,
44+ mapStyle: ' YOUR_MAP_STYLE' ,
45+ defaultInput: ' Bodhgaya'
46+ }
47+ },
48+ methods: {
49+ handleSearch (event ) {
50+ console .log (event )
51+ }
52+ },
53+ };
6154 </script >
6255```
6356
@@ -70,3 +63,12 @@ Each time you change value of this prop, mapbox-gl-geocoder `.setInput` method i
7063Same for ` proximity ` prop that internally invokes mapbox-gl-geocoder ` setProximity ` method.
7164
7265Also you can call ` query ` method to query search and get results programmatically.
66+
67+ ## Credits
68+ - Thanks to [ soal] ( https://github.com/soal ) & his original [ vue-mapbox-geocoder] ( https://github.com/soal/vue-mapbox-geocoder )
69+ - All contributors ([ list] ( https://github.com/geospoc/v-mapbox-geocoder/contributors ) ).
70+ - All GeoSpoc ([ team] ( https://github.com/orgs/Geospoc/people ) ).
71+
72+ ## License
73+
74+ MIT © ; [ GeoSpoc] ( https://geospoc.com )
0 commit comments