{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/geoapify/json-schema/geoapify-map-matching-feature-collection-schema.json",
  "title": "MapMatchingFeatureCollection",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/geoapify-map-matching-api-openapi.yml#/components/schemas/MapMatchingFeatureCollection",
  "type": "object",
  "required": [
    "type",
    "features"
  ],
  "properties": {
    "type": {
      "const": "FeatureCollection"
    },
    "features": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/MapMatchingFeature"
      }
    },
    "bbox": {
      "type": "array",
      "minItems": 4,
      "maxItems": 6,
      "items": {
        "type": "number"
      }
    },
    "properties": {
      "oneOf": [
        {
          "$ref": "#/$defs/JsonObject"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "$defs": {
    "JsonObject": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/JsonValue"
      }
    },
    "JsonValue": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        {
          "$ref": "#/$defs/JsonObject"
        }
      ]
    },
    "LongitudeLatitude": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "prefixItems": [
        {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        },
        {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        }
      ],
      "items": false
    },
    "MapMatchingFeature": {
      "type": "object",
      "required": [
        "type",
        "geometry",
        "properties"
      ],
      "properties": {
        "type": {
          "const": "Feature"
        },
        "geometry": {
          "$ref": "#/$defs/MultiLineStringGeometry"
        },
        "properties": {
          "$ref": "#/$defs/MapMatchingFeatureProperties"
        },
        "id": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            }
          ]
        },
        "bbox": {
          "type": "array",
          "minItems": 4,
          "maxItems": 6,
          "items": {
            "type": "number"
          }
        }
      }
    },
    "MapMatchingFeatureProperties": {
      "type": "object",
      "required": [
        "distance",
        "time",
        "legs",
        "mode",
        "waypoints"
      ],
      "properties": {
        "distance": {
          "type": "number"
        },
        "time": {
          "type": "number"
        },
        "legs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MapMatchingLeg"
          }
        },
        "mode": {
          "type": "string",
          "enum": [
            "walk",
            "hike",
            "scooter",
            "motorcycle",
            "drive",
            "light_truck",
            "bicycle",
            "mountain_bike",
            "road_bike",
            "bus",
            "medium_truck",
            "truck",
            "truck_dangerous_goods",
            "heavy_truck",
            "long_truck",
            "transit",
            "approximated_transit"
          ]
        },
        "waypoints": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "$ref": "#/$defs/MapMatchingWaypoint"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      }
    },
    "MapMatchingLeg": {
      "type": "object",
      "required": [
        "time",
        "distance",
        "steps"
      ],
      "properties": {
        "time": {
          "type": "number"
        },
        "distance": {
          "type": "number"
        },
        "steps": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MapMatchingStep"
          }
        }
      }
    },
    "MapMatchingStep": {
      "type": "object",
      "required": [
        "from_index",
        "to_index",
        "time",
        "distance",
        "osm_way_id"
      ],
      "properties": {
        "from_index": {
          "type": "integer"
        },
        "to_index": {
          "type": "integer"
        },
        "time": {
          "type": "number"
        },
        "distance": {
          "type": "number"
        },
        "instruction": {
          "$ref": "#/$defs/RouteInstruction"
        },
        "toll": {
          "type": "boolean"
        },
        "ferry": {
          "type": "boolean"
        },
        "bridge": {
          "type": "boolean"
        },
        "tunnel": {
          "type": "boolean"
        },
        "elevation": {
          "type": "number"
        },
        "elevation_gain": {
          "type": "number"
        },
        "max_elevation": {
          "type": "number"
        },
        "min_elevation": {
          "type": "number"
        },
        "admin_area": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        },
        "speed": {
          "type": "number"
        },
        "speed_limit": {
          "type": "number"
        },
        "truck_limit": {
          "type": "number"
        },
        "surface": {
          "type": "string"
        },
        "lane_count": {
          "type": "number"
        },
        "road_class": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "roundabout": {
          "type": "boolean"
        },
        "rightside": {
          "type": "boolean"
        },
        "traversability": {
          "type": "string"
        },
        "from_stop_id": {
          "type": "string"
        },
        "from_stop_name": {
          "type": "string"
        },
        "to_stop_id": {
          "type": "string"
        },
        "to_stop_name": {
          "type": "string"
        },
        "osm_way_id": {
          "type": "number"
        },
        "address": {
          "$ref": "#/$defs/MapMatchingStepAddress"
        },
        "osmtags": {
          "$ref": "#/$defs/JsonObject"
        },
        "overlaps": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MapMatchingStepOverlap"
          }
        },
        "begin_bearing": {
          "type": "number"
        },
        "end_bearing": {
          "type": "number"
        }
      }
    },
    "MapMatchingStepAddress": {
      "type": "object",
      "required": [],
      "properties": {
        "street": {
          "type": "string"
        },
        "suburb": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "county": {
          "type": "string"
        },
        "state": {
          "type": "string"
        },
        "postcode": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "country_code": {
          "type": "string"
        }
      }
    },
    "MapMatchingStepOverlap": {
      "type": "object",
      "required": [
        "osm_way_id",
        "osmtags",
        "intersection_points"
      ],
      "properties": {
        "osm_way_id": {
          "type": "number"
        },
        "osmtags": {
          "$ref": "#/$defs/JsonObject"
        },
        "intersection_points": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LongitudeLatitude"
          }
        }
      }
    },
    "MapMatchingWaypoint": {
      "type": "object",
      "required": [
        "original_index",
        "location",
        "original_location",
        "match_type"
      ],
      "properties": {
        "original_index": {
          "type": "integer"
        },
        "location": {
          "oneOf": [
            {
              "$ref": "#/$defs/LongitudeLatitude"
            },
            {
              "type": "null"
            }
          ]
        },
        "original_location": {
          "$ref": "#/$defs/LongitudeLatitude"
        },
        "match_type": {
          "type": "string",
          "enum": [
            "matched",
            "unmatched",
            "interpolated",
            "merged"
          ]
        },
        "match_distance": {
          "type": [
            "number",
            "null"
          ]
        },
        "leg_index": {
          "type": "integer"
        },
        "step_index": {
          "type": "integer"
        }
      }
    },
    "MultiLineStringGeometry": {
      "type": "object",
      "required": [
        "type",
        "coordinates"
      ],
      "properties": {
        "type": {
          "const": "MultiLineString"
        },
        "coordinates": {
          "type": "array",
          "items": {
            "type": "array",
            "minItems": 2,
            "items": {
              "$ref": "#/$defs/LongitudeLatitude"
            }
          }
        }
      }
    },
    "RouteInstruction": {
      "type": "object",
      "required": [
        "text"
      ],
      "properties": {
        "text": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "transition_instruction": {
          "type": "string"
        },
        "pre_transition_instruction": {
          "type": "string"
        },
        "post_transition_instruction": {
          "type": "string"
        },
        "contains_next_instruction": {
          "type": "boolean"
        },
        "streets": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "exit_number": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "exit_road_name": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "exit_towards": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "roundabout_exit": {
          "type": "number"
        }
      }
    }
  }
}