Bikesy’s bike routes are available via an API. This is still in beta and could change at any time.
Example
http://api.bikesy.com?lat1=37.7910183&lng1=-122.3991499&lat2=37.7700099&lng2=-122.44693656&hill=medium&safety=low&format=json
This example returns JSON for a bike route from the Financial district in San Francisco to Haight and Ashbury.
API Input
| Input | Description | Format | Example |
| lat1 | Latitude of starting point | Numeric | 37.7910 |
| lng1 | Longitude of starting point | Numeric | -122.3991 |
| lat2 | Latitude of ending point | Numeric | 37.7700 |
| lng2 | Longitude of ending point | Numeric | -122.4469 |
| hill | Hill Reluctance – corresponds to weighting hills less (less avoidance) | String | low, medium or high |
| safety | Safety – corresponds to weighting bike lanes and routes more | String | low, medium or high |
| format | Format of Results | String | json or xml |
| jsoncallback | JSON Callback | String | foo |
“High” Hill Reluctance corresponds to weighting hills less (less avoidance) and “high” safety corresponds to weighting bike lanes and routes more. If you don’t specify hill or safety “Medium” hill reluctance and “Medium” safety are used which give a reasonable route avoiding hills and trying to stick to bike routes and lanes.
API Output
JSON Output Format
?([[["DIRECTION, "STREET_NAME", 0, 0, 0, [LNG, LAT]], ["DIRECTION, "STREET_NAME", 0, 0, 0, [LNG, LAT]]], ["GOOGLE_MAPS_ENCODED_POLYLINE", ""], [[DISTANCE_ALONG_ROUTE, ELEVATION_IN_METERS], [DISTANCE_ALONG_ROUTE, ELEVATION_IN_METERS]], {"route_desc_time": 0.0098509788513183594, "route_find_time": 0.005039215087890625, "endpoint_find_time": 0.0011160373687744141}, {"total_elev": 0, "total_dist": 83.865702594686809}])
XML Output Format
<?xml version="1.0" encoding="UTF-8"?> <Ri> <d> DIRECTION STREET_NAME</d> <d> DIRECTION STREET_NAME</d> <r> <l>LAT</l> <o>LNG</o> <l>LAT</l> <o>LNG</o> </r> <cl>TOTAL_CLIMBING_ELEVATION_IN_METERS</cl> <ec>TOTAL_ELEVATION_CHANGE_IN_METERS</ec> <di>TOTAL_DISTANCE_IN_METERS</di> </Ri>
Example Input
http://api.bikesy.com?lat1=37.79099655151367&lng1=-122.39909362792969&lat2=37.78794572301525&lng2=-122.40700721740723&hill=low&safety=high&format=json
Example Output
?([[["start northwest", "Bush Street", 0, 0, 0, [-122.39909362792969, 37.790996551513672]], ["left", "Market Street", 0, 0, 0, [-122.39918518066406, 37.791069030761719]], ["right", "Grant Avenue", 0, 0, 0, [-122.40462493896484, 37.786762237548828]], ["left", "Campton Place", 0, 0, 0, [-122.40530395507812, 37.789161682128906]], ["left", "Stockton Street", 0, 0, 0, [-122.4068603515625, 37.788963317871094]]], ["u`teFhaajVMPzY~`@[n@cMvAf@vHxDc@", "B?@?@@B"], [[0, 5.090794563293457], [5.6952972412109375, 5.0808525085449219], [11.390594482421875, 5.0836153030395508], [11.390594482421875, 5.0836153030395508], [20.073694229125977, 5.0952515602111816], [28.756793975830078, 5.0946083068847656], [37.439895629882812, 5.1204252243041992], [46.122993469238281, 5.2670435905456543], [54.806095123291016, 5.3984313011169434], [54.806095123291016, 5.3984313011169434], [64.310752868652344, 5.4049463272094727], [73.815414428710938, 5.558535099029541], [83.320075988769531, 5.7657880783081055], [92.824737548828125, 5.9837870597839355], [102.32939147949219, 6.117337703704834], [111.83406066894531, 6.3355917930603027], [121.33871459960938, 6.5285472869873047], [130.84336853027344, 6.7212791442871094], [130.84336853027344, 6.7212791442871094], [140.75092697143555, 6.9430599212646484], [150.65848541259766, 7.1525249481201172], [160.5660457611084, 7.3502364158630371], [170.47360229492188, 7.5752978324890137], [180.38116073608398, 7.7956509590148926], [190.28872299194336, 7.9945430755615234], [200.19628143310547, 8.1527805328369141], [210.10383605957031, 8.3443746566772461], [220.01139831542969, 8.5513715744018555], [229.91895294189453, 8.7717456817626953], [239.82651519775391, 9.005366325378418], [249.73407745361328, 9.0577182769775391], [259.64163208007812, 9.1836910247802734], [269.5491943359375, 9.3808526992797852], [279.45675659179688, 9.4150514602661133], [289.36430358886719, 9.5016994476318359], [289.36430358886719, 9.5016994476318359], [299.306884765625, 9.7098836898803711], [309.24946594238281, 9.6829166412353516], [319.19204711914062, 9.8396329879760742], [329.13462829589844, 10.076035499572754], [339.07719421386719, 10.226306915283203], [349.019775390625, 10.29651927947998], [358.96235656738281, 10.401517868041992], [358.96235656738281, 10.401517868041992], [368.69822692871094, 10.612687110900879], [378.43408203125, 10.825814247131348], [388.16993713378906, 10.870715141296387], [397.90580749511719, 10.949289321899414], [407.64167785644531, 11.117964744567871], [417.37754821777344, 11.190513610839844], [427.11338806152344, 11.232234001159668], [436.84925842285156, 11.461199760437012], [446.58512878417969, 11.653609275817871], [456.32096862792969, 11.815173149108887], [466.05683898925781, 11.985589027404785], [475.79270935058594, 12.115141868591309], [475.79270935058594, 12.115141868591309], [485.07099914550781, 12.181975364685059], [494.34928894042969, 12.306812286376953], [503.62754821777344, 12.407444000244141], [512.90583801269531, 12.665482521057129], [522.18412780761719, 12.869108200073242], [531.46238708496094, 12.925114631652832], [540.74067687988281, 13.074662208557129], [540.74067687988281, 13.074662208557129], [550.57298278808594, 13.213672637939453], [560.40531921386719, 13.208253860473633], [570.23762512207031, 13.24895191192627], [580.06993103027344, 13.33223819732666], [589.90223693847656, 13.383220672607422], [599.73454284667969, 13.43757438659668], [609.56684875488281, 13.51103401184082], [619.39915466308594, 13.507919311523438], [629.23149108886719, 13.74571704864502], [639.06379699707031, 14.050485610961914], [648.89610290527344, 14.180371284484863], [658.72837829589844, 14.247829437255859], [668.56071472167969, 14.122160911560059], [678.39305114746094, 14.142421722412109], [688.22532653808594, 14.143918037414551], [688.22532653808594, 14.143918037414551], [697.09413719177246, 14.246791839599609], [705.96294784545898, 14.342877388000488], [714.83175849914551, 14.6595458984375], [724.46895217895508, 14.871933937072754], [734.10614776611328, 15.028750419616699], [743.74334335327148, 15.199889183044434], [753.38053894042969, 15.2781982421875], [763.01773071289062, 15.3739013671875], [772.65492248535156, 15.544597625732422], [781.98724365234375, 15.723336219787598], [791.31956481933594, 15.753419876098633], [800.65188598632812, 15.802582740783691], [809.98420715332031, 15.852910995483398], [809.98420715332031, 15.852910995483398], [818.97666931152344, 15.925028800964355], [827.96914672851562, 16.03773307800293], [836.96160888671875, 16.226062774658203], [845.95408630371094, 16.516523361206055], [854.94654846191406, 16.826622009277344], [863.93902587890625, 16.986061096191406], [863.93902587890625, 16.986061096191406], [872.58277893066406, 17.170339584350586], [881.22653198242188, 17.390497207641602], [889.87030029296875, 17.607759475708008], [898.51405334472656, 17.787311553955078], [907.15780639648438, 18.040992736816406], [915.80155944824219, 18.345361709594727], [915.80155944824219, 18.345361709594727], [924.87540245056152, 18.677911758422852], [933.94924545288086, 18.85075569152832], [943.0230884552002, 18.894283294677734], [952.09693145751953, 19.016002655029297], [952.09693145751953, 19.016002655029297], [960.25308990478516, 19.243038177490234], [968.40924453735352, 19.322711944580078], [968.40924453735352, 19.322711944580078], [978.32706451416016, 19.743488311767578], [988.24488067626953, 20.163700103759766], [998.16270446777344, 20.597265243530273], [1008.0805206298828, 21.024850845336914], [1017.9983367919922, 21.413749694824219], [1027.9161529541016, 21.836484909057617], [1037.8339691162109, 22.21697998046875], [1047.7517852783203, 22.540868759155273], [1057.6696166992188, 22.927242279052734], [1067.5874328613281, 23.266569137573242], [1077.5052490234375, 23.525445938110352], [1087.4230651855469, 23.972148895263672], [1097.3408813476562, 24.518943786621094], [1107.2586975097656, 24.861751556396484], [1107.2586975097656, 24.861751556396484], [1115.97216796875, 24.568815231323242], [1124.6856536865234, 24.170711517333984], [1133.3991241455078, 23.710359573364258], [1142.1125946044922, 23.290004730224609], [1150.8260650634766, 22.895902633666992], [1159.5395355224609, 22.56719970703125], [1159.5395355224609, 22.56719970703125], [1168.2364358901978, 22.37104606628418], [1176.9333362579346, 22.25935173034668], [1185.6302375793457, 22.243555068969727], [1194.3271369934082, 22.220756530761719], [1203.024040222168, 22.240787506103516], [1211.7209396362305, 22.250822067260742]], {"route_desc_time": 0.0024950504302978516, "route_find_time": 0.0055930614471435547, "endpoint_find_time": 0.00096106529235839844}, {"total_elev": 0, "total_dist": 52.300103938941596}])
Example Input
http://api.bikesy.com?lat1=37.79099655151367&lng1=-122.39909362792969&lat2=37.78794572301525&lng2=-122.40700721740723&hill=low&safety=high&format=xml
Example Output
<?xml version="1.0" encoding="UTF-8"?> <Ri> <d> Start northwest Bush street</d> <d> Left Market street</d> <d> Right Grant avenue</d> <d> Left Campton place</d> <d> Left Stockton street</d> <r> <l>37.7909965515</l> <o>-122.399093628</o> <l>37.7910690308</l> <o>-122.399185181</o> <l>37.7910690308</l> <o>-122.399185181</o> <l>37.7907943726</l> <o>-122.399536133</o> <l>37.7907943726</l> <o>-122.399536133</o> <l>37.790309906</l> <o>-122.400146484</o> <l>37.790309906</l> <o>-122.400146484</o> <l>37.7892951965</l> <o>-122.401412964</o> <l>37.7892951965</l> <o>-122.401412964</o> <l>37.7888565063</l> <o>-122.401977539</o> <l>37.7888565063</l> <o>-122.401977539</o> <l>37.7881126404</l> <o>-122.402915955</o> <l>37.7881126404</l> <o>-122.402915955</o> <l>37.7876968384</l> <o>-122.403434753</o> <l>37.7876968384</l> <o>-122.403434753</o> <l>37.7867622375</l> <o>-122.404624939</o> <l>37.7867622375</l> <o>-122.404624939</o> <l>37.7869033813</l> <o>-122.40486908</o> <l>37.7874183655</l> <o>-122.404968262</o> <l>37.7877502441</l> <o>-122.405036926</o> <l>37.7877502441</l> <o>-122.405036926</o> <l>37.788230896</l> <o>-122.405128479</o> <l>37.788230896</l> <o>-122.405128479</o> <l>37.7886924744</l> <o>-122.405220032</o> <l>37.7886924744</l> <o>-122.405220032</o> <l>37.7890167236</l> <o>-122.405273438</o> <l>37.7890167236</l> <o>-122.405273438</o> <l>37.7891616821</l> <o>-122.405303955</o> <l>37.7891616821</l> <o>-122.405303955</o> <l>37.7889633179</l> <o>-122.406860352</o> <l>37.7889633179</l> <o>-122.406860352</o> <l>37.7884979248</l> <o>-122.406768799</o> <l>37.7884979248</l> <o>-122.406768799</o> <l>37.7880325317</l> <o>-122.406684875</o> </r> <cl>19.9727768898</cl> <ec>17.160027504</ec> <di>1211.72093964</di> </Ri>
API Details
We made assumptions about weighting different OpenStreetMaps road classifications for each scenario. For all scenarios, busier road classifications such as “motorway” and “primary” were given a higher weight than less busy road classifications such as “tertiary” and “path”. Weights are multipliers on the actual length of the link so a higher weight on a segment of road means that we are more likely to avoid routing on that segment.
The weights used by bikesy for each scenario are shown below:
| Type | Example | Low | Medium | High |
| Highway:Motorway/Motorway Link | Bay Bridge, I-101 | 100 | 100 | 100 |
| Highway:Trunk/Trunk Link | 19th Ave, Lombard to I-101 | 1.2 | 1.35 | 1.5 |
| Highway:Primary/Primary Link | Geary, Cesar Chavez | 1.1 | 1.25 | 1.4 |
| Highway:Secondary/Secondary Link | Potrero, 3rd St | 1 | 1.1 | 1.2 |
| Highway:Residential | Shotwell | 1 | 0.95 | 0.9 |
| Highway:Living Street | *not in SF | 1 | 0.95 | 0.9 |
| Highway:Steps | any steps | 2 | 2 | 2 |
| Highway:Track | Wawona St (usually dirt track) | 1.1 | 1.05 | 1 |
| Highway:Pedestrian | Civic Center Plaza | 1.1 | 1.1 | 1.1 |
| Highway:Path | Usually dirt path | 1.1 | 1.05 | 1 |
| Highway:Cycleway | Octavia Blvd | 0.9 | 0.8 | 0.7 |
| Cycleway:Lane | Valencia | 0.9 | 0.8 | 0.7 |
| Cycleway:Track | Octavia Blvd | 0.9 | 0.8 | 0.7 |
| Cycleway:Path | Golden Gate Bridge | 0.9 | 0.8 | 0.7 |
| Bicycle:Designated | Ocean Ave (along beach) | 0.9 | 0.8 | 0.7 |
| Bicycle:Yes | El Camino Del Mar | 0.9 | 0.8 | 0.7 |
| Route:Bicycle | 0.9 | 0.8 | 0.7 |
Bikesy API Examples
- Bikesy.com uses the Bikesy API
- BayTripper for iPhone uses Bikesy for its bike directions
Contact Us
Let us know how you use the API, send us suggestions for improving it or ask us a question about our less-than-complete documentation. info@bikesy.com. Want to contribute? Fork our front end or back end and get going.