queryType: getRoadSegments*
The getRoadSegments queryType is passed to the API to get information about road segments.
See Special Case APIs for more information.
This API call will return a consolidated set of road segments that fall within any of the geospatial inputs i.e. zone, coordinates and/or ways. It will also pass information like the SegmentId, which can be used in other API calls.
Parameters
These parameters should be passed to the functionParameters object regardless of which method you choose to make an API request.
| Parameter | Description | Type | Defined Value Set | Value Req'd |
|---|---|---|---|---|
| queryType | Must equal getRoadSegments. | STRING | getRoadSegments | Y |
| asOfDate |
The date for which OSM base map version to use. This date must be reflective of the first day of the last month in the date range for which you plan to use any segments returned by this API. The value should be provided in YYYY-MM-DD string format. | STRING | - | Y |
| coordinates |
Array of objects representing longitude/latitude points to be used as a reference for identifying road segments. Each object contains:
| ARRAY | - | N |
| excludeServiceRoads | True to exclude service roads, false to include them. Defaults to true | BOOLEAN | - | N |
| isMetric | True for data to be returned in metric units, false for imperial. | BOOLEAN | true or false | Y |
| radius |
The radius distance (kilometers or miles) to apply to input coordinates to get the radius of interest for road segments. This value is required if coordinates have been input. The default value is 0 or no radius. | FLOAT64 | - | N |
| roadTypes | Array of strings representing the different road types for which you want data. Passing an empty array will return all road types. | ARRAY | List of OSM road types. Any value from the “Road Types” column found in the Data Dictionary. | N |
| ways | Array of integers representing way Ids for which you want data. | ARRAY | - | N |
| zones |
An array of objects representing the zones for which you want information. Each object contains:
| ARRAY | ZoneType - “Custom”, “Segment”, “State”, “County”, “City”, “TAZ”, “ZIP”, “CTR”, or “FSA” | N |
Responses
| Code | Type | Description |
|---|---|---|
| 200 | JSON | The requested data. |
| 401 | JSON | Occurs for various unauthorized tasks, such as not providing credentials in your parameters. |
| 500 | JSON | Occurs if an internal server error occurs. Contact altitudesupport@geotab.com if this occurs. |
Response Schema
| Attribute | Description | Data Type | Defined Value Set |
|---|---|---|---|
| AsOfDate | The date as of which the map snapshot was created for OSM. | DATE | - |
| CardinalDirectionStartingAtNodeFrom | Cardinal direction in the direction of NodeFrom to NodeTo. (Direction = 1). | STRING | - |
| CardinalDirectionStartingAtNodeTo | Cardinal direction in the direction of NodeTo to NodeFrom. (Direction = -1). | STRING | - |
| Country | The name of the country. | STRING | - |
| County | The name of the county. | STRING | - |
| CountyId | The county id. A County id is a unique identifier for a county; typically, the FIPS code or Canadian census subdivision CSDUID from StatCan. | STRING | - |
| Geography | A GeoJSON string representing the geography of the returned data. | STRING | - |
| ISO_3166_2 | The ISO 3166:2 code of the state. | STRING | - |
| ISO_A3 | ISO-A3 code for the country. | STRING | - |
| IsOneWay | Indicates if the road is one-way. True indicates the road is one way, false indicates the road is not one way. | BOOLEAN | True or False |
| NodeFrom | OSM NodeId of the start point of the segment. | INTEGER | - |
| NodeTo | OSM NodeId of the end point of the segment. | INTEGER | - |
| ReferenceDate | The most recent change set applied to OSM (generally, this is one to three weeks behind the AsOfDate). | DATE | - |
| RoadType | OSM road type. | STRING | Refer to OSM Road Mapping in the Data Dictionary. |
| SegmentId | Segment Id (also known as a Geotab segment ID that results from breaking down OSM ways into smaller road segments) or unique identifier for the segment. | STRING | - |
| SegmentIndex | The order of the segment, starting at 0, inside the OSM way. | INTEGER | - |
| SegmentName | Road name, if available. | STRING | - |
| WayId | Way Id (a collection of nodes defined by OpenStreetMap). | INTEGER | - |
Sample parameters
{
"asOfDate": "2023-10-01",
"excludeServiceRoads":true,
"queryType":"getRoadSegments",
"roadTypes":["motorway"],
"zones":[{
"ZoneId":"32003",
"ISO_3166_2":"US-NV",
"ZoneType":"County"
}]
}