I’m planning my family’s car road trip in Europe, and it struck me that a lot of boring planning and research can be automated with the help of LLMs (and the Wolfram Language, of course!). Here are some early ideas. With just a few lines of code, I already feel the planning power that I never had before :), and it feels that I’m just scratching the surface.
Let’s start with plotting a course from A to B:
ClearAll[drawDrivingDirections,goodLocationQ,goodLocations];​​drawDrivingDirections[locations_,labels:{__String}]:=Module[{​​dist=TravelDistance[locations,TravelMethod->"Driving"],​​time=TravelTime[locations,TravelMethod->"Driving"],​​distDirect=TravelDistance[{locations[[1]],locations[[-1]]},TravelMethod->"Driving"],​​timeDirect=TravelTime[{locations[[1]],locations[[-1]]},TravelMethod->"Driving"],​​directions=TravelDirections[locations,TravelMethod->"Driving"]​​},​​If[Length[locations]!=Length[labels],​​Return[Failure["IncorrectArguments",<|​​"MessageTemplate"->"locations has length `1` but labels has length `2`",​​"MessageParameters"->Length/@{locations,labels}|>]]];​​GeoGraphics[{​​Style[Line[directions],Thick,Red],​​GeoMarker/@locations,​​MapThread[Text[#1,#2,{-1,0},Background->LightPink]&,{labels,locations}]​​},​​PlotLabel->Style[StringForm["``\n`` [``]\nvs. direct: +`` [``]",StringRiffle[labels,"  "],time,Round@dist,time-timeDirect,Round[dist-distDirect]],FontWeight->Bold,FontSize->16],​​ImageSize->Full​​]​​];
For example, let’s plot directions from Geneva to Salzburg:
In[]:=
drawDrivingDirections
Geneva
CITY
,
Salzburg
CITY

Out[]=
I already know the distance and the rough time this trip would take me; but it goes through Zurich and Munich, the cities that I have already visited before. Can I find a more interesting route? Sure, we just need to ask ChatGPT for help, asking it to go through smaller towns and villages, and potentially avoiding certain cities:
DatasetFromList[header_,rows_]:=Dataset[AssociationThread[header,#]&/@rows]
In[]:=
ClearAll[llmSuggestions]​​llmSuggestions=LLMFunction["I am planning to car roadtrip. I will drive from `1` to `2`. `3`. \nPlease suggest some interesting points of interest"<>", such as small villages and towns, lakes, etc. along the way. I'm OK with small detours (no longer than 30 minutes)."<>​​"Please provide the answer in the following format. Do not include any preamble, just output the information requested. For each point, including "<>​​"the starting point and the end point, output: The location name, e.g., a city / lake / point of interest. Then on a new line, "<>​​"a paragraph of one or two sentences describing why the stop should be taken: what is interesting / remarkable about it, followed by an empty line."];
In[]:=
ClearAll[llmDirections]​​llmDirections[from_,to_,considerations_]:=Module[{​​response=llmSuggestions[from,to,considerations],​​data,entities​​},​​data=(StringTrim/@StringSplit[#,"\n"])&/@StringSplit[response,"\n\n"];​​entities=Interpreter["Entity"]/@data[[All,1]];​​DatasetFromList[{"Name","Location","Description"},MapThread[List,{data[[All,1]],entities,data[[All,2]]}]]​​]
In[]:=
llmDirections["Geneva","Salzburg","Avoid going through Bern, Zurich, and Munich, opting for smaller towns and villages instead"]
Out[]=
Name
Location
Description
Geneva, Switzerland
Geneva
Start your journey in Geneva, a global city and hub for diplomacy and banking. Famous for its Jet d'Eau, a large fountain in Lake Geneva, and the United Nations office, Geneva offers a picturesque setting with views of the surrounding Alps and Jura mountains.
Yvoire, France
Yvoire
Visit Yvoire, a medieval village on the shores of Lake Geneva, known for its beautifully preserved architecture, flower-decked streets, and the Garden of Five Senses, a labyrinth designed to stimulate your senses.
Annecy, France
Annecy
Annecy is often called the "Venice of the Alps" due to its charming canals, cobbled streets, and pastel-colored houses. The town is also known for its lake, Lac d'Annecy, one of the cleanest in Europe, perfect for a relaxing boat ride or a picnic by the water.
Chamonix, France
Chamonix-Mont-Blanc
Make a detour to Chamonix, nestled at the base of Mont Blanc. It's a haven for outdoor sports enthusiasts, offering activities like hiking, skiing, and mountain climbing. The town itself is vibrant with shops, eateries, and stunning alpine views.
Aosta, Italy
Aosta
Explore Aosta, an ancient Roman town known for its well-preserved Roman ruins, including the impressive Arch of Augustus and the Theatre. The town is also a gateway to the Italian Alps, offering scenic views and hiking opportunities.
Liechtenstein
Liechtenstein
Consider a quick visit to Liechtenstein, one of the world's smallest and richest countries. The capital, Vaduz, offers attractions like Vaduz Castle, home to the ruling prince, and the Liechtenstein National Museum.
Feldkirch, Austria
Feldkirch
Stop in Feldkirch, a medieval city in the western Austrian state of Vorarlberg. Explore its well-preserved old town, Schattenburg Castle, and enjoy the local markets that offer a variety of regional crafts and foods.
Hallstatt, Austria
Hallstatt
Visit Hallstatt, a UNESCO World Heritage site, known for its production of salt, dating back to prehistoric times. This picturesque village by the lake is perfect for exploring on foot, with beautiful buildings, and ancient mines.
Salzburg, Austria
Salzburg
End your trip in Salzburg, the city of Mozart and "The Sound of Music." Explore the historic center with its baroque architecture, visit Mozart's birthplace, and enjoy the vibrant cultural scene with numerous festivals, concerts, and exhibitions.
Let’s adjust our drawing function, accounting for Locations that might not resolve properly:
drawDrivingDirections[points:{__Entity}]:=drawDrivingDirections[points,EntityValue[#,"Name"]&/@points];​​​​goodLocationQ[loc_]:=Not[FailureQ[loc]||MissingQ[EntityValue[loc,"Latitude"]]];​​goodLocations[data_Dataset]:=Select[data,goodLocationQ[#Location]&];​​​​drawDrivingDirections[data_Dataset]:=drawDrivingDirections[Normal@goodLocations[data][All,"Location"]];
In[]:=
drawDrivingDirections[%467]
Hm, that’s an interesting suggestion, but it does a pretty long detour in Italy. Looking at the map, I have new idea: don’t leave Switzerland, visit Liechtenstein, and possibly Innsbruck.
In[]:=
llmDirections["Geneva","Salzburg","The path should go through Switzerland, than visit Liechtenstein, and go through Innsbruck"]
Out[]=
Name
Location
Description
Geneva, Switzerland
Geneva
Geneva is renowned for its picturesque lakeside setting and the iconic Jet d'Eau, one of the world's tallest water fountains. The city is also home to numerous international organizations, including the United Nations Office at Geneva.
Lausanne, Switzerland
Lausanne
Situated on the shores of Lake Geneva, Lausanne boasts the impressive Olympic Museum, since it's the headquarters of the International Olympic Committee. The city's old town is also worth exploring, with its beautiful cathedral and vibrant café culture.
Montreux, Switzerland
Montreux
Montreux is famous for its annual jazz festival and the stunning Château de Chillon, a medieval castle on the lake's edge. The town's lakeside promenade is lined with flowers, sculptures, and Mediterranean trees.
Liechtenstein
Liechtenstein
Despite its small size, Liechtenstein offers a charming capital, Vaduz, which features a castle still used by the royal family. The country is also known for its modern art museum, Kunstmuseum Liechtenstein, and its postage stamp museum.
Feldkirch, Austria
Feldkirch
Just over the border from Liechtenstein, Feldkirch is a medieval town with well-preserved architecture and a beautiful castle, Schattenburg. The town offers a glimpse into the region's history and a chance to enjoy traditional Austrian culture.
Innsbruck, Austria
Innsbruck
Innsbruck, nestled in the Alps, is famous for its winter sports and imperial architecture, including the Golden Roof. The city also serves as a gateway to numerous alpine adventures and has a vibrant old town with colorful buildings.
Achensee, Austria
Achen Lake
Achensee is Tyrol's largest lake and offers stunning alpine scenery perfect for relaxation and outdoor activities like hiking, sailing, and windsurfing. The lake's clear, turquoise waters make it a popular spot for tourists seeking tranquility or adventure.
Salzburg, Austria
Salzburg
Salzburg is celebrated as the birthplace of Mozart and for its well-preserved baroque architecture. The city's historic center, listed as a UNESCO World Heritage Site, includes the beautiful Mirabell Palace and Gardens and the medieval Hohensalzburg Fortress.
In[]:=
drawDrivingDirections[%]
Out[]=
That’s already better; I will play with the path between Montreux and Liechtenstein some more to get more stops there, but overall the path from Liechtenstein to Salzburg is already more interesting and avoid Munich. Let’s do a final touch to format a time and distance table:
Ok, let’s see what are our options from Montreux to Liechtenstein:
That’s interesting, but it goes up north and extends the travel time considerably. What about a path in the south, via Interlaken?
Well, this doesn’t work because Interlaken was not resolved properly:
We need a different one:
We can avoid going to Andermatt and find something else interesting along the day. I can go on and on. The ability to generate ideas, and quickly visualize the driving direction is quite addictive!

CITE THIS NOTEBOOK

Planning a road trip with AI: LLM functions and ChatGPT for driving route design​
by Victor Kryukov​
Wolfram Community, STAFF PICKS, May 2, 2024
​https://community.wolfram.com/groups/-/m/t/3168968