On the 1st July I will begin a month long journey to visit EVERY Wimpy restaurant in the UK. This is a charity event where I hope to raise both money and awareness for the Teenage Cancer Trust, a charity I have personal experience with. Wimpy was the first fast food restaurant in the UK and celebrates its 70th birthday this year. It was the biggest fast food chain in the UK for many years, and at one point had over 500 restaurants. If you’re interested in finding out about about my motivations, please visit my website, which I deployed using the Wolfram Cloud.​
​Today, there are 65 Wimpys scattered across the UK and to visit these locations in a timely manner is a logistical nightmare. Thankfully, with the Wolfram Language I am able to create tools to generate the information I need to optimize my route.
First, I need to get some data on the restaurants. Using the Wimpy’s API, I am able to do this easily.
In[]:=
readData=URLRead["https://wimpy.uk.com/api/locations?all=true"]
Out[]=
HTTPResponse
Status: OK
Content type: application/json

The data is in the form of a JSON. I make each entry an Association for convenience later.
In[]:=
jsonData=Association@@@ImportString[readData["Body"],"JSON"];
There are a number of fields for each Wimpy
In[]:=
Short[Union[Flatten[Keys/@jsonData]]]
Out[]//Short=
{accountId,additionalHoursText,address,address2,attire,bioListIds,bioListsLabel,75,yextDisplayLng,yextRoutableLat,yextRoutableLng,yextWalkableLat,yextWalkableLng,zip}
I am only interested in the longitude, latitude, address and opening times. The data needs to be processed so that it can be used more readily in the Wolfram Language. I can make a function which can extract out the longitude and latitude for the given restaurants data.
In[]:=
makeGeoPosition[x_Association]:=​​Module​​ {lat,lng},​​ lat=Lookup[x,"yextRoutableLat"];​​ lng=Lookup[x,"yextRoutableLng"];​​ GeoPosition[{lat,lng}]​​
The opening times data is slightly more complicated. The hours data is a single string. Days are in the form day:openingtime:closingtime, where the day is numerical form of the day of the week (Sunday is 1, Monday is 2, ...). The string can be parsed with the following.
In[]:=
dayKeys=1"Sunday",2"Monday",3"Tuesday",4"Wednesday",5"Thursday",6"Friday",7"Saturday";
In[]:=
split[str_String]:=ToExpression/@StringSplit[str,{":",","}];
In[]:=
openingTimes[str_String]:=<|Map[dayKeys[#[[1]]]-><|"Open"->TimeObject[#[[2;;3]]],"Close"->TimeObject[#[[4;;5]]]|>&,Partition[split[str],5]]|>
Now that I have my helper functions I can write create a Dataset with only the data I require.
In[]:=
wimpyData=DatasetMap​​ <|​​ "Id"->#id,​​ "OpeningTimes"->openingTimes[#["hours"]],​​ "GeoPosition"->makeGeoPosition[#],​​ "Address"-><|​​ "Street"->#["address"],​​ "City"->#["city"],​​ "County"->#["state"],​​ "Postcode"->#["zip"]​​ |>​​ |>&,​​ jsonData​​
Out[]=
Id
OpeningTimes
GeoPosition
Address
Open
Close
Street
City
County
Postcode
102
Sunday
10:00
21:00
51.37°N 0.4866°W
123 Station Road
Addlestone
Surrey
KT15 2AT
Monday
10:00
21:00
7 total ›
297
Sunday
09:30
15:00
51.25°N 0.7638°W
29-30 Lower Walk
Aldershot
Hampshire
GU11 1DB
Monday
09:00
17:00
7 total ›
296
Sunday
10:00
21:00
51.43°N 0.4646°W
41-43 Church Road
Ashford
Middlesex
TW15 2TY
Monday
10:00
21:00
7 total ›
106
Sunday
10:00
16:00
51.15°N 0.8708°E
22 Tufton Street
Ashford
Kent
TN23 1QN
Wednesday
09:30
17:00
5 total ›
314
Sunday
10:00
19:00
51.82°N 0.8112°W
Units 1 & 2, Hale Leys
Shopping Centre
Aylesbury
Buckinghamshire
HP20 1ST
Monday
09:00
19:30
7 total ›
108
Sunday
10:30
16:30
51.08°N 4.06°W
26 High Street
Barnstaple
Devon
EX31 1BL
Monday
08:30
18:00
7 total ›
288
Sunday
10:00
17:00
51.26°N 1.085°W
1-2 Chelsea House
Basingstoke
Hampshire
RG21 7JR
Monday
09:00
19:00
7 total ›
110-2
Sunday
11:00
19:00
51.41°N 0.03048°W
266-268 High Street
Beckenham
Greater London
BR3 1DZ
Monday
09:00
21:00
7 total ›
111-2
Sunday
10:00
20:00
51.57°N 0.5515°E
129 London Road
Benfleet
Essex
SS7 5UH
Monday
10:00
20:00
7 total ›
243
Sunday
11:00
22:00
51.49°N 0.0625°W
251a Southwark Park Road
Bermondsey
Greater London
SE16 3TS
Monday
10:00
22:00
7 total ›
rows 1–10 of 63
To minimize my travel time, I want to get to find the shortest tour of all the Wimpys. Using just the GeoPosition I use FindShortestTour.
In[]:=
allGeoPositions=Normal[wimpyData[All,"GeoPosition"]];
In[]:=
wimpyTour=FindShortestTour[allGeoPositions][[2]]
Out[]=
{1,3,15,31,12,5,48,50,60,14,17,30,40,16,32,59,28,29,20,11,45,8,24,62,39,10,55,44,22,33,38,63,46,23,58,42,4,52,56,9,47,37,61,53,19,18,26,41,36,49,34,27,21,35,13,43,51,6,57,54,7,2,25,1}
The tour above is in positional form. A route between one Wimpy to the next would be 2 adjacent values of wimpyTour. Feed these values into allGeoPositions and you get a start and end GeoPosition. For the first route it looks like this.
In[]:=
route1={allGeoPositions[[wimpyTour[[1]]]],allGeoPositions[[wimpyTour[[2]]]]}
Out[]=
{GeoPosition[{51.3718,-0.486553}],GeoPosition[{51.4336,-0.464569}]}
I can make a travel route using TravelDirections, which can give us step by step instructions and a path.
In[]:=
travel1=TravelDirections[route1]
Out[]=
TravelDirectionsData
Start: GeoPosition[{51.4,-0.487}]
End: GeoPosition[{51.4,-0.465}]

In[]:=
travel1["Dataset"]
Out[]=
Description
Distance
Time
ManeuverType
StartingPoint
EndingPoint
Path
Continue onto Station Road, B3121
280.348ft
6.835s
Straight
51.37°N 0.4865°W
51.37°N 0.4877°W
GeoPathGeoPosition
Number of points: 2
Lat bounds: {51.4,51.4}
Lon bounds: {-0.488,-0.487}
,"TravelPath"
At roundabout, take exit 2 onto Station Road, B3121
914.603ft
22.298s
UseRoundabout
51.37°N 0.4877°W
51.37°N 0.4916°W
…
Turn right onto Crouch Oak Lane
0.224055mi
28.845s
Right
51.37°N 0.4916°W
51.37°N 0.4925°W
GeoPathGeoPosition
Number of points: 5
Lat bounds: {51.4,51.4}
Lon bounds: {-0.493,-0.492}
,"TravelPath"
Turn left onto Crouch Oak Lane
133.12ft
3.246s
Left
51.37°N 0.4925°W
51.37°N 0.4931°W
GeoPathGeoPosition
Number of points: 3
Lat bounds: {51.4,51.4}
Lon bounds: {-0.493,-0.493}
,"TravelPath"
Turn right onto Chertsey Road, A318
0.381279mi
49.079s
Right
51.37°N 0.4931°W
51.38°N 0.4925°W
…
Keep right onto Chertsey Road, A318
141.079ft
3.44s
7
51.38°N 0.4925°W
51.38°N 0.4926°W
GeoPathGeoPosition
Number of points: 3
Lat bounds: {51.4,51.4}
Lon bounds: {-0.493,-0.492}
,"TravelPath"
At roundabout, take exit 2 onto Chertsey Road, A317
593.665ft
14.474s
UseRoundabout
51.38°N 0.4926°W
51.38°N 0.4937°W
GeoPathGeoPosition
Number of points: 8
Lat bounds: {51.4,51.4}
Lon bounds: {-0.494,-0.493}
,"TravelPath"
Continue onto Chertsey Road, A317
320.587ft
7.816s
Straight
51.38°N 0.4937°W
51.38°N 0.4943°W
GeoPathGeoPosition
Number of points: 4
Lat bounds: {51.4,51.4}
Lon bounds: {-0.494,-0.494}
,"TravelPath"
Continue onto Chertsey Road, A317
456.007ft
11.118s
Straight
51.38°N 0.4943°W
51.38°N 0.4944°W
GeoPathGeoPosition
Number of points: 4
Lat bounds: {51.4,51.4}
Lon bounds: {-0.494,-0.494}
,"TravelPath"
Continue onto Chertsey Road, A317
0.506769mi
65.238s
Straight
51.38°N 0.4944°W
51.39°N 0.4939°W
…
Turn right onto Bridge Road, B375
0.379497mi
48.854s
Right
51.39°N 0.4939°W
51.39°N 0.4856°W
GeoPathGeoPosition
Number of points: 8
Lat bounds: {51.4,51.4}
Lon bounds: {-0.494,-0.486}
,"TravelPath"
Turn left onto Thames Side
1.2735mi
163.955s
Left
51.39°N 0.4856°W
51.41°N 0.4923°W
…
Keep right onto Ferry Lane
0.211963mi
27.289s
7
51.41°N 0.4923°W
51.41°N 0.4895°W
…
Turn left onto Shepperton Road, B376
394.393ft
9.616s
Left
51.41°N 0.4895°W
51.41°N 0.4902°W
GeoPathGeoPosition
Number of points: 3
Lat bounds: {51.4,51.4}
Lon bounds: {-0.49,-0.49}
,"TravelPath"
Keep right onto The Broadway, B376
284.685ft
6.94s
7
51.41°N 0.4902°W
51.41°N 0.4894°W
GeoPathGeoPosition
Number of points: 6
Lat bounds: {51.4,51.4}
Lon bounds: {-0.49,-0.489}
,"TravelPath"
Turn slight right onto The Broadway, B377
1.33644mi
142.948s
SlightRight
51.41°N 0.4894°W
51.43°N 0.4747°W
…
Turn right onto Ashford Road, B377
480.22ft
11.707s
Right
51.43°N 0.4747°W
51.43°N 0.473°W
GeoPathGeoPosition
Number of points: 4
Lat bounds: {51.4,51.4}
Lon bounds: {-0.475,-0.473}
,"TravelPath"
At roundabout, take exit 2 onto Fordbridge Road, B377
303.648ft
7.401s
UseRoundabout
51.43°N 0.473°W
51.43°N 0.4723°W
GeoPathGeoPosition
Number of points: 8
Lat bounds: {51.4,51.4}
Lon bounds: {-0.473,-0.472}
,"TravelPath"
Turn slight left onto Fordbridge Road, B377
0.608186mi
77.741s
SlightLeft
51.43°N 0.4723°W
51.43°N 0.4621°W
…
Turn left onto Church Road, B378
515.446ft
9.425s
Left
51.43°N 0.4621°W
51.43°N 0.4641°W
GeoPathGeoPosition
Number of points: 2
Lat bounds: {51.4,51.4}
Lon bounds: {-0.464,-0.462}
,"TravelPath"
rows 1–20 of 22
This is how it looks on a map.
For a full list of all routes I can use MovingMap to give me every positional pair.
Which I can feed into allGeoPositions.
Now all I need to do is Map these values with TravelDirections to get every route.
Now all I need to do is plot my route using GeoGraphics. The following gives a basic black line style to each path.
I also want a GeoMarker for each restaurant location, with a ToolTip that shows the address and opening times.
Finally I use GeoGraphics to show these elements on a map. Note: For full functionality you need to download this notebook and use the Wolfram App on the desktop.
And that’s it, I now have my route!
Appendix
I’ve been developing a set of tools on GitHub called WimpyCodingTools, which has a lot more functionality. It still needs a lot of work but it’s already providing me a lot of value. I plan to cover this in future posts but if you fancy taking a look, please do. Here are some things I’ve found while looking at this data.
Wimpy’s which are in a 20 mile radius of London:
Total travel distance for the tour:
Longest distance to travel in single journey
Total driving time:
The most northern and southern Wimpy:
Let me know if you have any other interesting facts you can get from this data, or if my code can be improved in any way. Thanks for reading!

CITE THIS NOTEBOOK

How I plan to visit EVERY Wimpy Restaurant in the UK​
by Anthony Zupnik​
Wolfram Community, STAFF PICKS, June 10, 2024
​https://community.wolfram.com/groups/-/m/t/3189664