geocode/geocode.go

21 lines
423 B
Go
Raw Permalink Normal View History

2023-03-29 10:51:49 +00:00
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)
}