21 lines
423 B
Go
21 lines
423 B
Go
|
package geocode
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
geojson "github.com/paulmach/orb/geojson"
|
||
|
)
|
||
|
|
||
|
type Geocoder interface {
|
||
|
Autocomplete(text string) (*geojson.FeatureCollection, error)
|
||
|
}
|
||
|
|
||
|
func NewGeocoder(geocoder_type string, baseUrl string) (Geocoder, error) {
|
||
|
if geocoder_type == "pelias" {
|
||
|
handler, _ := NewPeliasHandler(baseUrl)
|
||
|
return handler, nil
|
||
|
}
|
||
|
|
||
|
return nil, fmt.Errorf("geocoder type %s does not exist", geocoder_type)
|
||
|
}
|