Documentation
¶
Index ¶
- Constants
- Variables
- type GOSRMError
- type OSRM
- type Options
- type OsrmClient
- func (c *OsrmClient) Match(_ *models.MatchRequest) (*models.OSRMResponse, error)
- func (c *OsrmClient) Nearest(_ *models.NearestRequest) (*models.OSRMResponse, error)
- func (c *OsrmClient) Route(r *models.RouteRequest) (*models.OSRMResponse, error)
- func (c *OsrmClient) Table(t *models.TableRequest) (*models.OSRMResponse, error)
Constants ¶
View Source
const CodeOK = "Ok"
Variables ¶
View Source
var RespCode = map[string]string{
"NoRoute": "No route found",
"NoTable": "No route found in table method.",
"NoMatch": "No matching found.",
"NoTrips": "No trips found because input coordinates are not connected.",
"NotImplemented": "This request is not supported",
"InvalidUrl": "URL string is invalid",
"Ok": "All OK",
"InvalidService": "Service name is invalid.",
"InvalidVersion": "OSRM Version is not found.",
"InvalidOptions": "Options are invalid.",
"InvalidQuery": "The query string is syntactically malformed.",
"InvalidValue": "The successfully parsed query parameters are invalid.",
"NoSegment": "One of the supplied input coordinates could not snap to street segment.",
"TooBig": "The request size violates one of the service specific request size restrictions",
}
Errors which could be returned from OSRM Server
Functions ¶
This section is empty.
Types ¶
type GOSRMError ¶ added in v0.1.0
func NewGOSRMError ¶ added in v0.1.0
func NewGOSRMError(url *url.URL, err error, rawResponse *[]byte) *GOSRMError
func (*GOSRMError) Error ¶ added in v0.1.0
func (e *GOSRMError) Error() string
type OSRM ¶
type OSRM interface {
Route(r *models.RouteRequest) (*models.OSRMResponse, error)
Table(r *models.TableRequest) (*models.OSRMResponse, error)
Match(r *models.MatchRequest) (*models.OSRMResponse, error)
Nearest(r *models.NearestRequest) (*models.OSRMResponse, error)
}
type Options ¶
type Options struct {
// Url of osrm server with / on the end
Url url.URL `json:"url"`
// One of the following values: route , nearest , table , match , trip , tile
Service string `json:"service"`
// Version of the protocol implemented by the service
Version string `json:"version"`
// Mode of transportation, is determined statically by the Lua profile that is used to prepare the data using osrm-extract
Profile string `json:"profile"`
GenerateHints bool `json:"generate_hints"`
// Timeout for request in seconds
RequestTimeout int `json:"request_timeout"`
// if need debug you should turn this on
Debug bool `json:"debug"`
}
OSRM client options structure
type OsrmClient ¶
type OsrmClient struct {
Options *Options
// contains filtered or unexported fields
}
Osrm Client Object
func NewClient ¶
func NewClient(options *Options) *OsrmClient
NewClient creates a client with options
func (*OsrmClient) Match ¶
func (c *OsrmClient) Match(_ *models.MatchRequest) (*models.OSRMResponse, error)
func (*OsrmClient) Nearest ¶
func (c *OsrmClient) Nearest(_ *models.NearestRequest) (*models.OSRMResponse, error)
func (*OsrmClient) Route ¶
func (c *OsrmClient) Route(r *models.RouteRequest) (*models.OSRMResponse, error)
func (*OsrmClient) Table ¶
func (c *OsrmClient) Table(t *models.TableRequest) (*models.OSRMResponse, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.