API reference/Core Maps, Search & Routing
POSTstatelesslegacy-source evidence

Snap to Road API

/{REST_KEY}/snapToRoad

Snap-To-Road API, snaps given GPS points to the road network in the most plausible way. Maximum number of points are limited to 100 only. Our USP is to take GPS points collected along a route and return a similar set of corrected & aligned data with the points matched to the road with our intelligent Snap To Road API. Now seamlessly calculate accurate distances from points which follow the geometry of the road & show accurate positions on map. This API provides a critical feature that is immensely valuable when tracking assets and for data analytics of path traversed by vehicle, people or assets. Note : The request might result multiple sub-traces. Large jumps in the timestamps (> 60s) or improbable transitions lead to trace splits if a complete matching could not be found. The algorithm might not be able to match all points. Outliers are removed if they cannot be matched successfully. Live Demo

Legacy contract evidence

This operation was normalized from a MapmyIndia-generation specification. Validate its current Mappls host, path, package entitlement, authentication generation, and commercial availability before production use.

Call the operation

POSThttps://apis.mapmyindia.com/advancedmaps/v1/YOUR_REST_KEY/snapToRoad
Base URLhttps://apis.mapmyindia.com/advancedmaps/v1
Authenticationnot declared
Journey rolerequest response
Content typesapplication/x-www-form-urlencoded

Parameters

NameLocationTypeDescriptionExample
REST_KEYrequired
pathstring

The REST API licence key allocated to you by signing into our services and registering yourself as a developer.

YOUR_REST_KEY

Body schema

FieldTypeDescriptionExample
ptsrequired
string

Coordinate is pair of comma separated longitude & latitude value, First coordinate will be consider as start point; a last coordinate will be as end points and between are via points; like {longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...]. At present maximum number of points are limited to 100 in a single request.

78.40573,17.37317;78.40958,17.37314;78.41845,17.37449;78.409992,17.37328;78.420460,17.377443;78.421350,17.380200
timestamps
string

Timestamps for the input locations in seconds since UNIX epoch. Timestamps need to be monotonically increasing. Values must be integer {timestamp};{timestamp};{timestamp} ...

1700000000000
geometries
string

This parameter used to change the route geometry format/density (influences overview and per step). Default value is polyline with 5 digit precision; polyline6 for 6digit precision; geojson for geometries as geojson. Please note that “timestamps” parameter is mandatory for enabling geometries.

polyline
radiuses
string

Standard deviation of GPS precision used for map matching. If available use GPS accuracy in meters. Default value is 5 metres. Values must be integer {radius};{radius};{radius} ...

50;50;50;50;50;50
region
string

This parameter is optional for India; for other countries (such as Sri Lanka, Nepal, Bangladesh, Bhutan + many more) this parameter is mandatory. Possible values are listed in a table here.

IND
Request body example
{
  "pts": "78.40573,17.37317;78.40958,17.37314;78.41845,17.37449;78.409992,17.37328;78.420460,17.377443;78.421350,17.380200"
}

Build your request in eight languages

Change source-backed examples once, validate required inputs, and copy the synchronized cURL, JavaScript, Python, Java, C#, Go, PHP, or Ruby request. Credentials remain environment references, and this page never sends a provider request.

Local request composerCode stays local · fixtures are explicit
POSTRequest inputs
0 editable · 1 protected
This operation has no editable path or query parameters.
Generated in eight languages
Environment-backed credentials
POSThttps://apis.mapmyindia.com/advancedmaps/v1/${MAPPLS_REST_KEY}/snapToRoad
Credential-free sandboxExecute this contract without a provider call
How fixtures work
Generated from your inputs
curl --request POST \
  --url "https://apis.mapmyindia.com/advancedmaps/v1/${MAPPLS_REST_KEY}/snapToRoad" \
  --header "Accept: application/json" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data-raw '{"pts":"78.40573,17.37317;78.40958,17.37314;78.41845,17.37449;78.409992,17.37328;78.420460,17.377443;78.421350,17.380200"}'

Credential-safe by constructionSet MAPPLS_REST_KEY only in your trusted runtime. Code generation stays local. Sandbox execution sends only bounded fixture inputs to this developer platform and never reads a credential or calls Mappls.

Send a production-shaped request

Examples use environment-backed access tokens, explicit timeouts where supported, status checks, and JSON bodies derived from the source schema. Replace sample identifiers and coordinates with values from your application.

POST /{REST_KEY}/snapToRoad
curl --request POST \
  --url 'https://apis.mapmyindia.com/advancedmaps/v1/YOUR_REST_KEY/snapToRoad' \
  --header 'Content-Type: application/json' \
  --data '{
  "pts": "78.40573,17.37317;78.40958,17.37314;78.41845,17.37449;78.409992,17.37328;78.420460,17.377443;78.421350,17.380200"
}'

Responses

200

OK

204

DB Connection error.

400

Bad request

401

API access denied

403

Forbidden

404

Not found

412

Precondition Failed, i.e. Some existing pre-condition in formulating a valid API request was not fulfilled.

500

Something went wrong

503

Internal server error

200 response fields

FieldTypeDescriptionExample
Serverrequired
string

Gives Information on active service's server.

Adv-5400
versionrequired
string

API’s version information.

250.19.5222
responseCoderequired
string

See the service dependent and general status codes

200
resultsrequired
object

No field description in the source contract.

example
results.snappedPointsrequired
array<object>

Array of Waypoint objects representing all points of the trace in order. If the trace point was omitted by map matching because it is an outlier, the entry will be null.

example
results.snappedPoints[].locationrequired
array<string>

Location of Matched point (Longitude, Latitude)

28.612964,77.229463
results.snappedPoints[].distancerequired
number

Distance from the snapped point.

4.014843
results.snappedPoints[].waypoint_indexrequired
number

Distance from the snapped point.

0
results.matchingsrequired
array<object>

An array of Route objects that assemble the trace.

example
results.matchings[].geometryrequired
string

Returns the whole geometry of the route as per given parameter ‘geometries’ default is encoded ‘polyline’ with 5 digit accuracy for positional coordinates. Geometry information is NOT available in most use-case driven response; and is RESTRICTED.

28.612964,77.229463
Response example
{
  "Server": "Adv-5400",
  "version": "250.19.5222",
  "responseCode": "200",
  "results": {
    "snappedPoints": [
      {
        "location": [
          77.113089,
          28.544643
        ],
        "distance": 4.014843,
        "waypoint_index": 0
      }
    ],
    "matchings": [
      {
        "geometry": "ie`iByrp}MN{HKeMXmOKuGq@}JaBaHaDmIgB{BuDcCuGeBeP{D"
      }
    ]
  }
}

Operate it safely

request-response

This operation is evaluated independently from the request. Cache and retry according to its documented semantics.

Keep credentials and raw tokens out of source, client bundles, prompts, and logs.Record the operation ID, status, latency, retry count, and source contract version in traces.Classify 4xx responses before retrying; back off and add jitter for retryable 5xx or transport failures.Cache only when request inputs, authorization scope, and freshness requirements permit it.

Contract provenance

Source file
contenthub/dochub/mapmyindia-rest-api/docs/custom/snapToRoad.yml
SHA-256
f05e344331821678f3463524df1c2729cabd344a994dd0a3877987cc6eb7b0e1
Normalization
Fields are parsed from OpenAPI. Operational guidance and language samples are generated and labeled separately.