routes-for-location Method
Search for routes near a specific location, optionally by name
Example Request
Example Response
{"code":200,"currentTime":1710977677779,"data":{"limitExceeded":true,"list":[{"agencyId":"1","color":"","description":"UW/Cascadia College - University District","id":"1_100214","longName":"","nullSafeShortName":"372","shortName":"372","textColor":"","type":3,"url":"https://kingcounty.gov/en/dept/metro/routes-and-service/schedules-and-maps/372.html"},{"agencyId":"1","color":"","description":"Univ Dist-Montlake-Capitol Hill-Downtown Seattle","id":"1_100223","longName":"","nullSafeShortName":"43","shortName":"43","textColor":"","type":3,"url":"https://kingcounty.gov/en/dept/metro/routes-and-service/schedules-and-maps/043.html"},{"agencyId":"1","color":"","description":"Lake City - University District","id":"1_100254","longName":"","nullSafeShortName":"65","shortName":"65","textColor":"","type":3,"url":"https://kingcounty.gov/en/dept/metro/routes-and-service/schedules-and-maps/065.html"},{"agencyId":"1","color":"","description":"University District - Eastlake - Downtown Seattle","id":"1_100264","longName":"","nullSafeShortName":"70","shortName":"70","textColor":"","type":3,"url":"https://kingcounty.gov/en/dept/metro/routes-and-service/schedules-and-maps/070.html"},{"agencyId":"1","color":"","description":"Jackson Park - Univ District","id":"1_100267","longName":"","nullSafeShortName":"73","shortName":"73","textColor":"","type":3,"url":"https://kingcounty.gov/en/dept/metro/routes-and-service/schedules-and-maps/073.html"},{"agencyId":"1","color":"","description":"Northgate - Lake City - Sand Point - Univ District","id":"1_100269","longName":"","nullSafeShortName":"75","shortName":"75","textColor":"","type":3,"url":"https://kingcounty.gov/en/dept/metro/routes-and-service/schedules-and-maps/075.html"},{"agencyId":"1","color":"","description":"Madrona - Lakeside School","id":"1_100346","longName":"","nullSafeShortName":"988","shortName":"988","textColor":"","type":3,"url":"https://kingcounty.gov/en/dept/metro/routes-and-service/schedules-and-maps/988.html"},{"agencyId":"1","color":"","description":"Lake City - Northgate - University District","id":"1_102730","longName":"","nullSafeShortName":"20","shortName":"20","textColor":"","type":3,"url":"https://kingcounty.gov/en/dept/metro/routes-and-service/schedules-and-maps/020.html"},{"agencyId":"1","color":"","description":"Greenlake - University District","id":"1_102732","longName":"","nullSafeShortName":"79","shortName":"79","textColor":"","type":3,"url":"https://kingcounty.gov/en/dept/metro/routes-and-service/schedules-and-maps/079.html"},{"agencyId":"40","color":"28813F","description":"1 Line runs between Northgate Station and Angle Lake Station seven days a week","id":"40_100479","longName":"Northgate - Angle Lake","nullSafeShortName":"1 Line","shortName":"1 Line","textColor":"FFFFFF","type":0,"url":"https://www.soundtransit.org/1"}],"outOfRange":false,"references":{"agencies":[{"disclaimer":"","email":"","fareUrl":"https://kingcounty.gov/en/dept/metro/fares-and-payment/prices","id":"1","lang":"EN","name":"Metro Transit","phone":"206-553-3000","privateService":false,"timezone":"America/Los_Angeles","url":"https://kingcounty.gov/en/dept/metro"},{"disclaimer":"","email":"main@soundtransit.org","fareUrl":"https://www.soundtransit.org/ride-with-us/how-to-pay/fares","id":"40","lang":"en","name":"Sound Transit","phone":"1-888-889-6368","privateService":false,"timezone":"America/Los_Angeles","url":"https://www.soundtransit.org"}],"routes":[],"situations":[],"stopTimes":[],"stops":[],"trips":[]}},"text":"OK","version":2}
Request Parameters
lat
- The latitude coordinate of the search centerlon
- The longitude coordinate of the search centerradius
- The search radius in meters (optional)latSpan
/lonSpan
- An alternative toradius
to set the search bounding box (optional)query
- A specific route short name to search for (optional)
If you just specify a lat
,lon
search location, the routes-for-location
method will just return nearby routes. If you specify an optional query
parameter, we’ll search for nearby routes with the specified route short name. This is the primary method from going from a user-facing route name like “44” to the actual underlying route id unique to a route for a particular transit agency.
Response
The routes-for-location
method returns a list result, so see additional documentation on controlling the number of elements returned and interpreting the results. The list contents are <route/>
elements.