{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-maps/json-schema/microsoft-azure-maps-snap-to-roads-request-schema.json",
  "title": "SnapToRoadsRequest",
  "description": "This object is the request body.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-maps-route-api-openapi.yml#/components/schemas/SnapToRoadsRequest",
  "type": "object",
  "properties": {
    "type": {
      "$ref": "#/$defs/FeatureTypeEnum",
      "description": "Specifies the `GeoJSON` type. The only supported object type is\n`FeatureCollection`. For more information, see [RFC\n7946](https://www.rfc-editor.org/rfc/rfc7946)."
    },
    "features": {
      "type": "array",
      "description": "A set of points to snap to road network. You can have a minimum of 2 points and\nmaximum of 5000 points and the two consecutive points must be within 6\nkilometer of each other and a total road distance of up to 100 kilometers.\nRefer to [RFC 7946](https://www.rfc-editor.org/rfc/rfc7946) for details on the\nGeoJSON format.\n\n`Note`: The API will not return a point object in the response for the GPS\npoint that cannot be snapped to a road network.",
      "minItems": 2,
      "maxItems": 100,
      "items": {
        "$ref": "#/$defs/InputSnapToRoadsFeaturesItem"
      }
    },
    "interpolate": {
      "type": "boolean",
      "description": "Specifies whether to return additional points between the snapped points to\ncomplete the full route path that smoothly follows the road geometry.\n\nThe interpolated points will have `isInterpolate:true` in the response which\ncan be used to identify the snapped points from interpolated points.",
      "default": false
    },
    "includeSpeedLimit": {
      "type": "boolean",
      "description": "Specifies whether to include speed limit information for the snapped points in\nthe response. The unit is in kilometers per hour.",
      "default": false
    },
    "travelMode": {
      "type": "string",
      "description": "Specifies the routing profile for snapping the points. If unspecified, the\ndefault mode is \"driving\", which optimizes the snapped points for driving\nroutes.",
      "default": "driving",
      "enum": [
        "driving",
        "truck"
      ],
      "x-ms-enum": {
        "name": "SnapToRoadsTravelModeEnum",
        "modelAsString": true,
        "values": [
          {
            "name": "driving",
            "value": "driving",
            "description": "The points are snapped to the road suitable for cars."
          },
          {
            "name": "truck",
            "value": "truck",
            "description": "The points are snapped to the road suitable for truck."
          }
        ]
      }
    }
  },
  "required": [
    "type",
    "features"
  ],
  "$defs": {
    "FeatureTypeEnum": {
      "type": "string",
      "description": "Specifies the `GeoJSON` type. The only supported object type is\n`FeatureCollection`. For more information, see [RFC\n7946](https://www.rfc-editor.org/rfc/rfc7946).",
      "enum": [
        "FeatureCollection"
      ],
      "x-ms-enum": {
        "name": "FeatureTypeEnum",
        "modelAsString": true,
        "values": [
          {
            "name": "FeatureCollection",
            "value": "FeatureCollection",
            "description": "Specifies the `GeoJSON` `FeatureCollection` object type."
          }
        ]
      }
    },
    "FeaturesItemTypeEnum": {
      "type": "string",
      "description": "Specifies the `GeoJSON` type. The only supported object type is Feature. For\nmore information, see [RFC 7946](https://www.rfc-editor.org/rfc/rfc7946).",
      "enum": [
        "Feature"
      ],
      "x-ms-enum": {
        "name": "FeaturesItemTypeEnum",
        "modelAsString": true,
        "values": [
          {
            "name": "Feature",
            "value": "Feature",
            "description": "Specifies the `GeoJSON` Feature object type."
          }
        ]
      }
    },
    "GeoJsonGeometry": {
      "type": "object",
      "description": "A valid `GeoJSON` geometry object. The type must be one of the seven valid\nGeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString,\nPolygon, MultiPolygon and GeometryCollection. Please refer to [RFC\n7946](https://tools.ietf.org/html/rfc7946#section-3.1) for details.",
      "properties": {
        "type": {
          "$ref": "#/$defs/GeoJsonObjectType",
          "description": "Specifies the `GeoJSON` type. Must be one of the nine valid GeoJSON object\ntypes - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon,\nGeometryCollection, Feature and FeatureCollection."
        }
      },
      "required": [
        "type"
      ]
    },
    "GeoJsonObjectType": {
      "type": "string",
      "description": "Specifies the `GeoJSON` type. Must be one of the nine valid GeoJSON object\ntypes - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon,\nGeometryCollection, Feature and FeatureCollection.",
      "enum": [
        "Point",
        "MultiPoint",
        "LineString",
        "MultiLineString",
        "Polygon",
        "MultiPolygon",
        "GeometryCollection",
        "Feature",
        "FeatureCollection"
      ],
      "x-ms-enum": {
        "name": "GeoJsonObjectType",
        "modelAsString": false,
        "values": [
          {
            "name": "GeoJsonPoint",
            "value": "Point",
            "description": "`GeoJSON Point` geometry."
          },
          {
            "name": "GeoJsonMultiPoint",
            "value": "MultiPoint",
            "description": "`GeoJSON MultiPoint` geometry."
          },
          {
            "name": "GeoJsonLineString",
            "value": "LineString",
            "description": "`GeoJSON LineString` geometry."
          },
          {
            "name": "GeoJsonMultiLineString",
            "value": "MultiLineString",
            "description": "`GeoJSON MultiLineString` geometry."
          },
          {
            "name": "GeoJsonPolygon",
            "value": "Polygon",
            "description": "`GeoJSON Polygon` geometry."
          },
          {
            "name": "GeoJsonMultiPolygon",
            "value": "MultiPolygon",
            "description": "`GeoJSON MultiPolygon` geometry."
          },
          {
            "name": "GeoJsonGeometryCollection",
            "value": "GeometryCollection",
            "description": "`GeoJSON GeometryCollection` geometry."
          },
          {
            "name": "GeoJsonFeature",
            "value": "Feature",
            "description": "`GeoJSON Feature` object."
          },
          {
            "name": "GeoJsonFeatureCollection",
            "value": "FeatureCollection",
            "description": "`GeoJSON FeatureCollection` object."
          }
        ]
      }
    },
    "GeoJsonPoint": {
      "type": "object",
      "description": "A valid `GeoJSON Point` geometry type. Please refer to [RFC\n7946](https://tools.ietf.org/html/rfc7946#section-3.1.2) for details.",
      "properties": {
        "coordinates": {
          "type": "array",
          "description": "A `Position` is an array of numbers with two or more elements. The first two\nelements are _longitude_ and _latitude_, precisely in that order.\n_Altitude/Elevation_ is an optional third element. Please refer to [RFC\n7946](https://tools.ietf.org/html/rfc7946#section-3.1.1) for details.",
          "items": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "required": [
        "coordinates"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/GeoJsonGeometry"
        }
      ],
      "x-ms-discriminator-value": "Point"
    },
    "InputSnapToRoadsFeaturesItem": {
      "type": "object",
      "description": "Specifies the input snap to roads points. `GeoJSON` feature object and\nadditional properties. Refer to [RFC\n7946](https://www.rfc-editor.org/rfc/rfc7946) for details.",
      "properties": {
        "type": {
          "$ref": "#/$defs/FeaturesItemTypeEnum",
          "description": "Specifies the `GeoJSON` type. The only supported object type is Feature. For\nmore information, see [RFC 7946](https://www.rfc-editor.org/rfc/rfc7946)."
        },
        "geometry": {
          "$ref": "#/$defs/GeoJsonPoint",
          "description": "A valid `GeoJSON Point` geometry type. Please refer to [RFC\n7946](https://tools.ietf.org/html/rfc7946#section-3.1.2) for details."
        },
        "properties": {
          "type": "object",
          "description": "The properties object is required in a valid GeoJSON but it can be empty since\nthe metadata is not used for snapping to road.",
          "additionalProperties": {}
        }
      },
      "required": [
        "type",
        "geometry",
        "properties"
      ]
    }
  }
}