Documentation
¶
Index ¶
- Variables
- func MarshalCoordinatesArray(arr []Coordinates) string
- type ApiError
- type BannerComponent
- type BannerContent
- type BannerInstruction
- type CategoryListItem
- type CategoryListRequest
- type CategoryListResponse
- type CategoryRequest
- type ChargingWaypointMetadata
- type ClientOption
- type Coordinates
- type DirectionsRequest
- type DirectionsResponse
- type DrivingParams
- type DrivingTrafficParams
- type ForwardRequest
- type Geometry
- type Incident
- type Intersection
- type IsochroneFeature
- type IsochroneFeatureGeometry
- type IsochroneFeatureProps
- type IsochroneRequest
- type IsochroneResponse
- type Lane
- type Logger
- type MapboxClient
- func (c *MapboxClient) Directions() *directionsApi
- func (c *MapboxClient) Isochrone() *isochroneApi
- func (c *MapboxClient) SearchBox() *searchBoxApi
- func (c *MapboxClient) SetBaseUrl(baseUrl string)
- func (c *MapboxClient) SetHttpClient(httpClient *http.Client)
- func (c *MapboxClient) SetLogger(logger Logger)
- type Overview
- type RetrieveRequest
- type ReverseLookupRequest
- type Route
- type RouteAnnotation
- type RouteLeg
- type RouteLegAdmin
- type RouteLegClosure
- type RouteNotification
- type RouteStep
- type RoutingProfile
- type SearchResponse
- type StepManeuver
- type SuggestRequest
- type SuggestResponse
- type Suggestion
- type TimeZone
- type ViaWaypoint
- type VoiceInstruction
- type WalkingParams
- type Waypoint
Constants ¶
This section is empty.
Variables ¶
var ErrNoAccessToken = errors.New("mapbox: Access token is missing")
Functions ¶
func MarshalCoordinatesArray ¶
func MarshalCoordinatesArray(arr []Coordinates) string
Types ¶
type ApiError ¶
type BannerComponent ¶
type BannerComponent struct {
Type string `json:"type"` // e.g., "icon", "text"
Text string `json:"text"`
Abbr string `json:"abbr"`
AbbrPriority int `json:"abbr_priority"`
ImageBaseUrl string `json:"imageBaseURL"`
Directions []string `json:"directions"`
Active bool `json:"active"`
ActiveDirection string `json:"active_direction"`
}
type BannerContent ¶
type BannerInstruction ¶
type BannerInstruction struct {
DistanceAlongGeometry float64 `json:"distanceAlongGeometry"`
Primary BannerContent `json:"primary"`
Secondary *BannerContent `json:"secondary,omitempty"`
Sub *BannerContent `json:"sub,omitempty"`
}
https://docs.mapbox.com/api/navigation/directions/#banner-instruction-object
type CategoryListItem ¶
type CategoryListItem struct {
// [required] The canonical category ID to use in a category “Hot Button” search
CanonicalId string `json:"canonical_id"`
// [required] The Maki icon to use with the category
Icon string `json:"icon"`
// [required] The category name in the requested language
Name string `json:"name"`
Version string `json:"version,omitempty"`
UUID string `json:"uuid,omitempty"`
}
type CategoryListRequest ¶
type CategoryListRequest struct {
// The ISO language code to be returned. If not provided, the default is English.
Language string `url:"language,omitempty"`
}
type CategoryListResponse ¶
type CategoryListResponse struct {
// An array of category objects
ListItems []CategoryListItem `json:"listItems"`
// The attribution data for results.
Attribution string `json:"attribution"`
// The service version information. Include this information if you report an issue to Mapbox.
Version string `json:"version"`
}
type CategoryRequest ¶
type CategoryRequest struct {
// [required] the list of IDs can be retrieved with the /list/category endpoint
CanonicalCategoryId string `url:"-"`
// The ISO language code to be returned. If not provided, the default is English.
Language string `url:"language,omitempty"`
// The number of results to return, up to 10.
Limit limit `url:"-"`
// Bias the response to favor results that are closer to a specific location.
// Provide either ip to get results closest to the user's IP location or provide two comma-separated coordinates in longitude,latitude order.
// If not provided, the default is IP proximity.
// When both proximity and origin are provided, origin is interpreted as the target of a route, while proximity indicates the current user location.
Proximity string `url:"proximity,omitempty"`
// Limit results to only those contained within the supplied bounding box.
// Bounding boxes should be supplied as four numbers separated by commas, in minimum longitude,minimum latitude,maximum longitude,maximum latitude order.
// The bounding box cannot cross the 180th meridian.
Bbox geojson.BoundingBox `url:"-"`
// A comma-separated list of ISO 3166 alpha 2 country codes.
Country string `url:"country,omitempty"`
// Limit results to one or more types of features, provided as a comma-separated list.
// Pass one or more of the type names as a comma separated list.
// If no types are specified, all possible types may be returned.
// Available types are: country, region, postcode, district, place, city, locality, neighborhood, street, address, poi, and category.
Types string `url:"types,omitempty"`
// A comma-separated list of canonical category names that limits POI results to those that are not part of the given categories.
PoiCategoryExclusions string `url:"poi_category_exclusions,omitempty"`
// Enable search-along-route (SAR) requests that shows the search results around the path provided with route parameter.
// The only allowed value for this parameter is isochrone.
SarType string `url:"sar_type,omitempty"`
// When SAR is enabled, a polyline encoded linestring describing the route to be used for searching.
// Both polyline5 and polyline6 precision are accepted, but must be specified using the route_geometry parameter.
// Note that for /forward queries searching along a route, only brand and category searches are supported.
Route string `url:"route,omitempty"`
// When SAR is enabled, passed in conjunction with a route polyline describing its precision.
// Options are polyline or polyline6.
// If this parameter is not provided with a route, the default is polyline. Correct results depend on including the right route_geometry for the route provided.
RouteGeometry string `url:"route_geometry,omitempty"`
// When SAR is enabled, maximum detour allowed in estimated minutes from the route.
TimeDeviation int `url:"time_deviation,omitempty"`
}
type ChargingWaypointMetadata ¶
type ChargingWaypointMetadata struct {
Type string `json:"type"`
Name string `json:"name"`
ChargeTime int `json:"charge_time"`
ChargeTo int `json:"charge_to"`
ChargeAtArrival int `json:"charge_at_arrival"`
PlugType string `json:"plug_type"`
CurrentType string `json:"current_type"`
PowerKw int `json:"power_kw"`
StationId string `json:"station_id"`
ProviderNames string `json:"provider_names"`
}
https://docs.mapbox.com/api/navigation/directions/#charging-waypoint-metadata
type ClientOption ¶
type ClientOption func(*MapboxClient)
type Coordinates ¶
func UnmarshalCoordinates ¶
func UnmarshalCoordinates(str string) (Coordinates, error)
func UnmarshalCoordinatesArray ¶
func UnmarshalCoordinatesArray(str string) ([]Coordinates, error)
func (*Coordinates) Marshal ¶
func (c *Coordinates) Marshal() string
type DirectionsRequest ¶
type DirectionsRequest struct {
// [required] The routing profile to use. Possible values are mapbox/driving-traffic, mapbox/driving, mapbox/walking, or mapbox/cycling.
//
// Path parameter
Profile RoutingProfile `url:"-"`
// [required] A semicolon-separated list of between two and 25 {longitude},{latitude} coordinate pairs to visit in order.
//
// Path parameter
Coordinates []Coordinates `url:"-"`
// An alternative route is a route that is significantly different from the fastest route, but still close in time.
// Such a route does not exist in all circumstances. Up to two alternatives may be returned.
Alternatives bool `url:"alternatives,omitempty"`
// Return additional metadata along the route. Must be used in conjunction with overview=full.
Annotations string `url:"annotations,omitempty"`
// Add a radius around the starting point in which the API will avoid returning any significant maneuvers.
// Possible values are in the range from 1 to 1000 meters.
// Use this option when the vehicle is traveling at a significant speed to avoid dangerous maneuvers when re-routing.
AvoidManeuverRadius uint16 `url:"avoid_maneuver_radius,omitempty"`
// Influences the direction in which a route starts from a waypoint.
// Used to filter the road segment the waypoint will be placed on by direction.
// This is useful for making sure the new routes of rerouted vehicles continue traveling in their current direction.
Bearings string `url:"bearings,omitempty"`
// Influences the layer of road from which a route starts from a waypoint.
// Used to filter the road segment the waypoint will be placed on, in Z-order.
// This is useful to avoid ambiguity in the case of multi-level roads (for example, a tunnel under a road).
// Takes a single signed integer per waypoint.
Layers string `url:"layers,omitempty"`
// Sets the allowed direction of travel when departing intermediate waypoints.
// If true, the route will continue in the same direction of travel.
// If false, the route may continue in the opposite direction of travel.
// Defaults to true for mapbox/driving and mapbox/driving-traffic, and false for mapbox/walking and mapbox/cycling.
ContinueStraight bool `url:"continue_straight,omitempty"`
// Exclude certain road types and custom locations from routing.
// Default is to not exclude anything from the list below.
// You can specify multiple values as a comma-separated list.
Exclude string `url:"exclude,omitempty"`
// The format of the returned geometry.
// Allowed values are: geojson (as LineString),
// polyline (default, a polyline with a precision of five decimal places),
// polyline6 (a polyline with a precision of six decimal places).
Geometries Geometry `url:"geometries,omitempty"`
// Include certain additional road types for routing.
// The default is to not include these road types.
// You can specify multiple values as a comma-separated list.
Include string `url:"include,omitempty"`
Overview Overview `url:"overview,omitempty"`
// Values can be any number greater than 0 or the string unlimited.
Radiuses string `url:"radiuses,omitempty"`
Approaches string `url:"approaches,omitempty"`
Steps bool `url:"steps,omitempty"`
BannerInstructions bool `url:"banner_instructions,omitempty"`
Language string `url:"language,omitempty"`
RoundaboutExits bool `url:"roundabout_exits,omitempty"`
VoiceInstructions bool `url:"voice_instructions,omitempty"`
VoiceUnits string `url:"voice_units,omitempty"`
Waypoints string `url:"waypoints,omitempty"`
WaypointsPerRoute bool `url:"waypoints_per_route,omitempty"`
WaypointNames string `url:"waypoint_names,omitempty"`
WaypointTargets string `url:"waypoint_targets,omitempty"`
Notifications string `url:"notifications,omitempty"`
WalkingParams
DrivingParams
DrivingTrafficParams
}
https://docs.mapbox.com/api/navigation/directions/#retrieve-directions
type DirectionsResponse ¶
type DrivingParams ¶
type DrivingParams struct {
AlleyBias float64 `url:"alley_bias,omitempty"`
ArriveBy string `url:"arrive_by,omitempty"`
DepartAt string `url:"depart_at,omitempty"`
MaxHeight float64 `url:"max_height,omitempty"`
MaxWidth float64 `url:"max_width,omitempty"`
MaxWeight float64 `url:"max_weight,omitempty"`
}
https://docs.mapbox.com/api/navigation/directions/#optional-parameters-for-the-mapboxdriving-profile
type DrivingTrafficParams ¶
type ForwardRequest ¶
type ForwardRequest struct {
// [required] The user's query string. The query is limited to 256 characters.
Query string `url:"q"`
// The ISO language code to be returned. If not provided, the default is English.
Language string `url:"language,omitempty"`
// The number of results to return, up to 10.
Limit limit `url:"-"`
// Bias the response to favor results that are closer to a specific location.
// Provide either ip to get results closest to the user's IP location or provide two comma-separated coordinates in longitude,latitude order.
// If not provided, the default is IP proximity.
// When both proximity and origin are provided, origin is interpreted as the target of a route, while proximity indicates the current user location.
Proximity string `url:"proximity,omitempty"`
// Limit results to only those contained within the supplied bounding box.
// Bounding boxes should be supplied as four numbers separated by commas, in minimum longitude,minimum latitude,maximum longitude,maximum latitude order.
// The bounding box cannot cross the 180th meridian.
Bbox geojson.BoundingBox `url:"-"`
// A comma-separated list of ISO 3166 alpha 2 country codes.
Country string `url:"country,omitempty"`
// Limit results to one or more types of features, provided as a comma-separated list.
// Pass one or more of the type names as a comma separated list.
// If no types are specified, all possible types may be returned.
// Available types are: country, region, postcode, district, place, city, locality, neighborhood, street, address, poi, and category.
Types string `url:"types,omitempty"`
// Limit results to those that belong to one or more categories, provided as a comma-separated list.
PoiCategory string `url:"poi_category,omitempty"`
// A comma-separated list of canonical category names that limits POI results to those that are not part of the given categories.
PoiCategoryExclusions string `url:"poi_category_exclusions,omitempty"`
// Enable Autocomplete Mode by setting the value to true.
// When Autocomplete Mode is enabled, the search results will include partial and fuzzy matches.
// This behavior enhances search functionality by suggesting potential matches as the user types, making it suitable for autocomplete implementations.
Autocomplete string `url:"auto_complete,omitempty"`
// Enable Estimate Time Arrival (ETA) calculation in the response.
// The only allowed value for this parameter is navigation.
// When this parameters is used, navigation_profile and either origin or proximity is also should be provided.
// Enabling ETA calculations will introduce additional latency and incur extra costs,
// as each search result for which ETAs are calculated (matrix elements) will be billed according to the Mapbox Matrix API pricing.
EtaType string `url:"eta_type,omitempty"`
// Available profiles are: driving, walking, and cycling.
NavigationProfile string `url:"navigation_profile,omitempty"`
// When ETA calculation is enabled, location from which to calculate distance.
// Provided as two comma-separated coordinates in longitude,latitude order.
// When both proximity and origin are provided, origin is interpreted as the target of a route,
// while proximity indicates the current user location.
Origin string `url:"origin,omitempty"`
}
type Incident ¶
type Incident struct {
Id string `json:"id"`
Type string `json:"type"`
Description string `json:"description"`
LongDescription string `json:"long_description"`
CreationTime string `json:"creation_time"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
Impact string `json:"impact"`
LanesBlocked []string `json:"lanes_blocked"`
NumLanesBlocked uint8 `json:"num_lanes_blocked"`
Congestion struct {
Value uint8 `json:"value"`
} `json:"congestion"`
Closed bool `json:"closed"`
GeometryIndexStart int `json:"geometry_index_start"`
GeometryIndexEnd int `json:"geometry_index_end"`
SubType string `json:"sub_type"`
SubTypeDescription string `json:"sub_type_description"`
Iso31661Alpha2 string `json:"iso_3166_1_alpha2"`
Iso31661Alpha3 string `json:"iso_3166_1_alpha3"`
AffectedRoadNames []string `json:"affected_road_names"`
Sout float64 `json:"south"`
West float64 `json:"west"`
North float64 `json:"north"`
East float64 `json:"east"`
}
type Intersection ¶
type Intersection struct {
Location []float64 `json:"location"`
Bearings []int `json:"bearings"`
Classes []string `json:"classes"`
Entry []bool `json:"entry"`
GeometryIndex int `json:"geometry_index"`
In int `json:"in,omitempty"`
Out int `json:"out,omitempty"`
Lanes []Lane `json:"lanes,omitempty"`
Duration float64 `json:"duration"`
TunnelName string `json:"tunnel_name"`
MapboxStreetsV8 struct {
Class string `json:"class"`
} `json:"mapbox_streets_v8"`
IsUrban bool `json:"is_urban"`
AdminIndex int `json:"admin_index"`
RestStop struct {
Type string `json:"type"`
Name string `json:"name"`
} `json:"rest_stop"`
TollCollection struct {
Type string `json:"type"`
Name string `json:"name"`
} `json:"toll_collection"`
RailwayCrossing bool `json:"railway_crossing"`
TrafficSignal bool `json:"traffic_signal"`
StopSign bool `json:"stop_sign"`
YieldSign bool `json:"yield_sign"`
}
type IsochroneFeature ¶
type IsochroneFeature struct {
// [required] This will always be "Feature".
Type string `json:"type"`
// [required] An object describing the spatial geometry of the returned feature.
Geometry IsochroneFeatureGeometry `json:"geometry"`
Properties IsochroneFeatureProps `json:"properties"`
}
type IsochroneFeatureProps ¶
type IsochroneFeatureProps struct {
Contour int `json:"contour,omitempty"`
Color string `json:"color,omitempty"`
Opacity float64 `json:"opacity,omitempty"`
Fill string `json:"fill,omitempty"`
FillDashOpacity float64 `json:"fill-opacity,omitempty"`
FillColor string `json:"fillColor,omitempty"`
FillOpacity float64 `json:"fillOpacity,omitempty"`
Metric string `json:"metric,omitempty"`
}
type IsochroneRequest ¶
type IsochroneRequest struct {
Profile RoutingProfile `url:"-"`
Coordinates Coordinates `url:"-"`
ContoursMinutes []uint8 `url:"contours_minutes,comma"`
ContoursMeters []uint32 `url:"contours_meters,comma"`
ContoursColors []string `url:"contours_colors,omitempty,comma"`
Polygons bool `url:"polygons,omitempty"`
Denoise float64 `url:"denoise,omitempty"`
Generalize float64 `url:"generalize,omitempty"`
Exclude string `url:"exclude,omitempty"`
DepartAt string `url:"depart_at,omitempty"`
}
type IsochroneResponse ¶
type IsochroneResponse struct {
Type string `json:"type"`
Features []IsochroneFeature `json:"features"`
}
https://docs.mapbox.com/api/navigation/isochrone/#response-retrieve-isochrones-around-a-location
type Lane ¶
type Lane struct {
Valid bool `json:"valid"`
Active bool `json:"active"`
ValidIndication string `json:"valid_indication,omitempty"`
Indications []string `json:"indications"`
Access struct {
Designated []string `json:"designated"`
} `json:"access"`
}
https://docs.mapbox.com/api/navigation/directions/#lane-object
type MapboxClient ¶
type MapboxClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(accessToken string, options ...ClientOption) (*MapboxClient, error)
func (*MapboxClient) Directions ¶
func (c *MapboxClient) Directions() *directionsApi
func (*MapboxClient) Isochrone ¶
func (c *MapboxClient) Isochrone() *isochroneApi
func (*MapboxClient) SearchBox ¶
func (c *MapboxClient) SearchBox() *searchBoxApi
MARK: API functions
func (*MapboxClient) SetBaseUrl ¶
func (c *MapboxClient) SetBaseUrl(baseUrl string)
func (*MapboxClient) SetHttpClient ¶
func (c *MapboxClient) SetHttpClient(httpClient *http.Client)
func (*MapboxClient) SetLogger ¶
func (c *MapboxClient) SetLogger(logger Logger)
type RetrieveRequest ¶
type RetrieveRequest struct {
// [required] path parameter
MapboxId string `url:"-"`
// The ISO language code to be returned. If not provided, the default is English.
Language string `url:"language,omitempty"`
// Enable Estimate Time Arrival (ETA) calculation in the response.
// The only allowed value for this parameter is navigation.
// When this parameters is used, navigation_profile and either origin or proximity is also should be provided.
// Enabling ETA calculations will introduce additional latency and incur extra costs,
// as each search result for which ETAs are calculated (matrix elements) will be billed according to the Mapbox Matrix API pricing.
EtaType string `url:"eta_type,omitempty"`
// Available profiles are: driving, walking, and cycling.
NavigationProfile string `url:"navigation_profile,omitempty"`
// When ETA calculation is enabled, location from which to calculate distance.
// Provided as two comma-separated coordinates in longitude,latitude order.
// When both proximity and origin are provided, origin is interpreted as the target of a route,
// while proximity indicates the current user location.
Origin string `url:"origin,omitempty"`
// contains filtered or unexported fields
}
type ReverseLookupRequest ¶
type ReverseLookupRequest struct {
// [required] The longitudinal coordinate of coordinate for the reverse query.
Longitude float64 `url:"longitude"`
// [required] The latitudinal coordinate of coordinate for the reverse query.
Latitude float64 `url:"latitude"`
// The ISO language code to be returned. If not provided, the default is English.
Language string `url:"language,omitempty"`
// The number of results to return, up to 10.
Limit limit `url:"-"`
// A comma-separated list of ISO 3166 alpha 2 country codes.
Country string `url:"country,omitempty"`
// Limit results to one or more types of features, provided as a comma-separated list.
// Pass one or more of the type names as a comma separated list.
// If no types are specified, all possible types may be returned.
// Available types are: country, region, postcode, district, place, city, locality, neighborhood, street, address, poi, and category.
Types string `url:"types,omitempty"`
}
type Route ¶
type Route struct {
Duration float64 `json:"duration"`
Distance float64 `json:"distance"`
WeightName string `json:"weight_name"`
Weight float64 `json:"weight"`
DurationTypical float64 `json:"duration_typical"`
WeightTypical float64 `json:"weight_typical"`
Geometry any `json:"geometry"`
Legs []RouteLeg `json:"legs"`
VoiceLocale string `json:"voiceLocale"`
Waypoints []Waypoint `json:"waypoints,omitempty"` // If waypoints_per_route is true
}
A route object describes a route through multiple waypoints.
https://docs.mapbox.com/api/navigation/directions/#route-object
type RouteAnnotation ¶
type RouteAnnotation struct {
Congestion []string `json:"congestion,omitempty"`
CongestionNumeric []float64 `json:"congestion_numeric,omitempty"`
Distance []float64 `json:"distance,omitempty"`
Duration []float64 `json:"duration,omitempty"`
MaxSpeed []struct {
Speed int `json:"speed"`
Unit string `json:"unit"`
Unknown bool `json:"unknown"`
None bool `json:"none"`
} `json:"maxspeed,omitempty"`
StateOfCharge []float64 `json:"state_of_charge,omitempty"`
Speed []float64 `json:"speed,omitempty"`
}
type RouteLeg ¶
type RouteLeg struct {
Distance float64 `json:"distance"`
Duration float64 `json:"duration"`
Weight float64 `json:"weight"`
DurationTypical float64 `json:"duration_typical"`
WeightTypical float64 `json:"weight_typical"`
Steps []RouteStep `json:"steps"`
Summary string `json:"summary"`
Admins []RouteLegAdmin `json:"admins"`
Incidents []Incident `json:"incidents"`
Closures []RouteLegClosure `json:"closures"`
Annotation RouteAnnotation `json:"annotation"`
ViaWaypoints []ViaWaypoint `json:"via_waypoints"`
Notifications []RouteNotification `json:"notifications"`
}
A route leg is the journey from an origin point to a destination point.
https://docs.mapbox.com/api/navigation/directions/#route-leg-object
type RouteLegAdmin ¶
type RouteLegClosure ¶
type RouteNotification ¶
type RouteNotification struct {
Type string `json:"type"`
Subtype string `json:"subtype"`
RefreshType string `json:"refresh_type"`
GeometryIndex int `json:"geometry_index"`
GeometryIndexStart int `json:"geometry_index_start"`
GeometryIndexEnd int `json:"geometry_index_end"`
StationId string `json:"station_id"`
Reason string `json:"reason"`
Details struct {
RequestedValue string `json:"requested_value"`
ActualValue string `json:"actual_value"`
Unit string `json:"unit"`
Message string `json:"message"`
} `json:"details"`
}
https://docs.mapbox.com/api/navigation/directions/#notification-object
type RouteStep ¶
type RouteStep struct {
Maneuver StepManeuver `json:"maneuver"`
Distance float64 `json:"distance"`
Duration float64 `json:"duration"`
Weight float64 `json:"weight"`
DurationTypical float64 `json:"duration_typical"`
WeightTypical float64 `json:"weight_typical"`
Geometry string `json:"geometry"` // Polyline string or GeoJSON
Name string `json:"name"`
Ref string `json:"ref,omitempty"`
Destinations string `json:"destinations"`
Exits string `json:"exits"`
DrivingSide string `json:"driving_side"`
Mode string `json:"mode"`
Pronunciation string `json:"pronunciation"`
Intersections []Intersection `json:"intersections,omitempty"`
SpeedLimitSign string `json:"speedLimitSign"`
SpeedLimitUnit string `json:"speedLimitUnit"`
VoiceInstructions []VoiceInstruction `json:"voiceInstructions,omitempty"`
BannerInstructions []BannerInstruction `json:"bannerInstructions,omitempty"`
}
https://docs.mapbox.com/api/navigation/directions/#route-step-object
type RoutingProfile ¶
type RoutingProfile string
RoutingProfile represents the routing profile to use.
const ( ProfileWalking RoutingProfile = "mapbox/walking" ProfileCycling RoutingProfile = "mapbox/cycling" ProfileDriving RoutingProfile = "mapbox/driving" ProfileDrivingTraffic RoutingProfile = "mapbox/driving-traffic" )
func (RoutingProfile) String ¶
func (p RoutingProfile) String() string
type SearchResponse ¶
type SearchResponse struct {
// This will always be "FeatureCollection".
Type string `json:"type"`
Features []geojson.MapboxFeature `json:"features"`
Attribution string `json:"attribution"`
}
type StepManeuver ¶
type StepManeuver struct {
BearingBefore float64 `json:"bearing_before"`
BearingAfter float64 `json:"bearing_after"`
Instruction string `json:"instruction"`
Location []float64 `json:"location"`
Modifier string `json:"modifier,omitempty"`
Type string `json:"type"`
}
https://docs.mapbox.com/api/navigation/directions/#step-maneuver-object
type SuggestRequest ¶
type SuggestRequest struct {
// [required] The user's query string. The query is limited to 256 characters.
Query string `url:"q"`
// The ISO language code to be returned. If not provided, the default is English.
Language string `url:"language,omitempty"`
// The number of results to return, up to 10.
Limit limit `url:"-"`
// Bias the response to favor results that are closer to a specific location.
// Provide either ip to get results closest to the user's IP location or provide two comma-separated coordinates in longitude,latitude order.
// If not provided, the default is IP proximity.
// When both proximity and origin are provided, origin is interpreted as the target of a route, while proximity indicates the current user location.
Proximity string `url:"proximity,omitempty"`
// Limit results to only those contained within the supplied bounding box.
// Bounding boxes should be supplied as four numbers separated by commas, in minimum longitude,minimum latitude,maximum longitude,maximum latitude order.
// The bounding box cannot cross the 180th meridian.
Bbox geojson.BoundingBox `url:"-"`
// A comma-separated list of ISO 3166 alpha 2 country codes.
Country string `url:"country,omitempty"`
// Limit results to one or more types of features, provided as a comma-separated list.
// Pass one or more of the type names as a comma separated list.
// If no types are specified, all possible types may be returned.
// Available types are: country, region, postcode, district, place, city, locality, neighborhood, street, address, poi, and category.
Types string `url:"types,omitempty"`
// Limit results to those that belong to one or more categories, provided as a comma-separated list.
PoiCategory string `url:"poi_category,omitempty"`
// A comma-separated list of canonical category names that limits POI results to those that are not part of the given categories.
PoiCategoryExclusions string `url:"poi_category_exclusions,omitempty"`
// Enable Estimate Time Arrival (ETA) calculation in the response.
// The only allowed value for this parameter is navigation.
// When this parameters is used, navigation_profile and either origin or proximity is also should be provided.
// Enabling ETA calculations will introduce additional latency and incur extra costs,
// as each search result for which ETAs are calculated (matrix elements) will be billed according to the Mapbox Matrix API pricing.
EtaType string `url:"eta_type,omitempty"`
// Available profiles are: driving, walking, and cycling.
NavigationProfile string `url:"navigation_profile,omitempty"`
// When ETA calculation is enabled, location from which to calculate distance.
// Provided as two comma-separated coordinates in longitude,latitude order.
// When both proximity and origin are provided, origin is interpreted as the target of a route,
// while proximity indicates the current user location.
Origin string `url:"origin,omitempty"`
// contains filtered or unexported fields
}
type SuggestResponse ¶
type SuggestResponse struct {
Suggestions []Suggestion `json:"suggestions"`
Attribution string `json:"attribution"`
}
The response to a request to the /suggest endpoint is an array of JSON suggestion objects. A suggestion will include a result name, address information, geographical context, and additional metadata when available (such as distance to proximity point). It does not include geographic coordinates. To get coordinates, make a call to the /retrieve endpoint with the mapbox_id provided in the /suggest result.
Using the limit parameter, you can increase the maximum number of results up to 10. Pagination is not available, but this feature may be added in a later release. There is not an option to customize the order of search results.
type Suggestion ¶
type Suggestion struct {
// [required] The name of the feature.
Name string `json:"name"`
// [optional] The preferred name of the feature, if different than name.
NamePreferred string `json:"name_preferred,omitempty"`
// [required] The id to use with /retrieve to get full feature details.
MapboxId string `json:"mapbox_id"`
// [required] The type of the result.
// For POIs, this will be poi.
// For categories, this will be category.
// For address-type results, the global context hierarchy is used (country, region, postcode, district, place, locality, neighborhood, address).
FeatureType string `json:"feature_type"`
// [optional] The address of the result containing the address number and street.
Address string `json:"address,omitempty"`
// [optional] The full address of the result, which concatenates address and place_formatted.
FullAddress string `json:"full_address,omitempty"`
// [required] A formatted string of result context comprised of the place, region, country, and postcode.
PlaceFormatted string `json:"place_formatted"`
// [required] The context of the feature. This context has layers that follow the Administrative unit types.
Context geojson.MapboxContext `json:"context"`
// [required] An IETF language tag indicating the language of the result.
Language string `json:"language"`
// [optional] A string representing an associated Maki icon to use for this result.
Maki string `json:"maki,omitempty"`
// [optional] An array including the POI categories the result falls into, if it is a POI.
PoiCategory []string `json:"poi_category,omitempty"`
// [optional] An array including the canonical POI category IDs the result falls into, if it is a POI.
PoiCategoryIds []string `json:"poi_category_ids,omitempty"`
// [optional] An array containing associated commercial brand names for the result, if it is a POI and is applicable.
Brand []string `json:"brand,omitempty"`
// [optional] An array containing canonical IDs of commercial brands for the result, if it is a POI and is applicable.
BrandId []string `json:"brand_id,omitempty"`
// [optional] An object containing the IDs of the feature found in external databases, with the keys being the data source names and the values being the IDs.
ExternalIds map[string]string `json:"external_ids,omitempty"`
// [optional] An object containing additional metadata for the feature, if applicable.
Metadata map[string]any `json:"metadata"`
// [optional] An approximate distance to the origin location, in meters.
// If origin is not provided, it will show the approximate distance to the proximity location, in meters.
Distance int `json:"distance,omitempty"`
// [optional] The estimated time of arrival from the origin point to the feature, in minutes.
// If origin is not provided, then this will be the estimated time of arrival from the proximity point to the feature, in minutes.
// Only provided when eta_type, navigation_profile and origin/proximity are used in the request.
// If an address is not on the road network, an ETA will not be provided.
Eta int `json:"eta,omitempty"`
// [optional] The distance added to an input route by including the given suggestion, in meters.
AddedDistance int `json:"added_distance,omitempty"`
// [optional] The estimated time added to an input route by including the given suggestion, in minutes.
AddedTime int `json:"added_time,omitempty"`
}
type TimeZone ¶
type TimeZone struct {
Identifier string `json:"identifier"`
Offset string `json:"offset"`
Abbreviation string `json:"abbreviation"`
}
https://docs.mapbox.com/api/navigation/directions/#time-zone-information
type ViaWaypoint ¶
type VoiceInstruction ¶
type VoiceInstruction struct {
DistanceAlongGeometry float64 `json:"distanceAlongGeometry"`
Announcement string `json:"announcement"`
SSMLAnnouncement string `json:"ssmlAnnouncement"`
}
https://docs.mapbox.com/api/navigation/directions/#voice-instruction-object
type WalkingParams ¶
type WalkingParams struct {
// The walking speed, in meters per second, with a minimum of 0.14 m/s (or 0.5 km/h) and a maximum of 6.94 m/s (or 25.0 km/h).
// Defaults to 1.42 m/s (5.1 km/h).
WalkingSpeed float64 `url:"walking_speed,omitempty"`
// A scale from -1 to 1, where -1 biases the route against walkways and 1 biases the route toward walkways.
// The default is 0, which is neutral.
WalkwayBias float64 `url:"walkway_bias,omitempty"`
}
https://docs.mapbox.com/api/navigation/directions/#optional-parameters-for-the-mapboxwalking-profile
type Waypoint ¶
type Waypoint struct {
Name string `json:"name"`
Location []float64 `json:"location"` // [longitude, latitude]
TimeZone TimeZone `json:"time_zone"`
Distance *float64 `json:"distance,omitempty"`
Metadata ChargingWaypointMetadata `json:"metadata"`
}
https://docs.mapbox.com/api/navigation/directions/#waypoint-object