Skip to content

Latest commit

 

History

History
89 lines (60 loc) · 6.06 KB

File metadata and controls

89 lines (60 loc) · 6.06 KB

\MapMatchingAPI

All URIs are relative to https://graphhopper.com/api/1

Method HTTP request Description
PostGPX Post /match Map-match a GPX file

PostGPX

RouteResponse PostGPX(ctx).GpsAccuracy(gpsAccuracy).Profile(profile).Locale(locale).Elevation(elevation).Details(details).Instructions(instructions).CalcPoints(calcPoints).PointsEncoded(pointsEncoded).Execute()

Map-match a GPX file

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/meission/go-graphhopper"
)

func main() {
	gpsAccuracy := int32(56) // int32 | Specify the precision of a point, in meter (optional)
	profile := "profile_example" // string |  (optional) (default to "car")
	locale := "locale_example" // string | The locale of the resulting turn instructions. E.g. `pt_PT` for Portuguese or `de` for German.  (optional) (default to "en")
	elevation := true // bool | If `true`, a third coordinate, the altitude, is included with all positions in the response. This changes the format of the `points` and `snapped_waypoints` fields of the response, in both their encodings. Unless you switch off the `points_encoded` parameter, you need special code on the client side that can handle three-dimensional coordinates.  (optional) (default to false)
	details := []string{"Inner_example"} // []string | Optional parameter. The following path details are available: `street_name`, `street_ref`, `street_destination`, `leg_time`, `leg_distance`, `roundabout`, `country`, `time`, `distance`, `max_speed`, `max_weight`, `max_width`, `toll`, `road_class`, `road_class_link`, `road_access`, `road_environment`, `hazmat`, `hazmat_tunnel`, `hazmat_water`,  `lanes`, `surface`, `smoothness`, `hike_rating`, `mtb_rating`, `foot_network`, `bike_network`. Read more about the usage of path details [here](https://discuss.graphhopper.com/t/2539).  (optional)
	instructions := true // bool | If instructions should be calculated and returned  (optional) (default to true)
	calcPoints := true // bool | If the points for the route should be calculated at all.  (optional) (default to true)
	pointsEncoded := true // bool | Allows changing the encoding of location data in the response. The default is polyline encoding, which is compact but requires special client code to unpack. (We provide it in our JavaScript client library!) Set this parameter to `false` to switch the encoding to simple coordinate pairs like `[lon,lat]`, or `[lon,lat,elevation]`. See the description of the response format for more information.  (optional) (default to true)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.MapMatchingAPI.PostGPX(context.Background()).GpsAccuracy(gpsAccuracy).Profile(profile).Locale(locale).Elevation(elevation).Details(details).Instructions(instructions).CalcPoints(calcPoints).PointsEncoded(pointsEncoded).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MapMatchingAPI.PostGPX``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PostGPX`: RouteResponse
	fmt.Fprintf(os.Stdout, "Response from `MapMatchingAPI.PostGPX`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiPostGPXRequest struct via the builder pattern

Name Type Description Notes
gpsAccuracy int32 Specify the precision of a point, in meter
profile string [default to "car"]
locale string The locale of the resulting turn instructions. E.g. `pt_PT` for Portuguese or `de` for German. [default to "en"]
elevation bool If `true`, a third coordinate, the altitude, is included with all positions in the response. This changes the format of the `points` and `snapped_waypoints` fields of the response, in both their encodings. Unless you switch off the `points_encoded` parameter, you need special code on the client side that can handle three-dimensional coordinates. [default to false]
details []string Optional parameter. The following path details are available: `street_name`, `street_ref`, `street_destination`, `leg_time`, `leg_distance`, `roundabout`, `country`, `time`, `distance`, `max_speed`, `max_weight`, `max_width`, `toll`, `road_class`, `road_class_link`, `road_access`, `road_environment`, `hazmat`, `hazmat_tunnel`, `hazmat_water`, `lanes`, `surface`, `smoothness`, `hike_rating`, `mtb_rating`, `foot_network`, `bike_network`. Read more about the usage of path details here.
instructions bool If instructions should be calculated and returned [default to true]
calcPoints bool If the points for the route should be calculated at all. [default to true]
pointsEncoded bool Allows changing the encoding of location data in the response. The default is polyline encoding, which is compact but requires special client code to unpack. (We provide it in our JavaScript client library!) Set this parameter to `false` to switch the encoding to simple coordinate pairs like `[lon,lat]`, or `[lon,lat,elevation]`. See the description of the response format for more information. [default to true]

Return type

RouteResponse

Authorization

api_key

HTTP request headers

  • Content-Type: application/gpx+xml
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]