In the past couple weeks, I’ve shown you how to use machine learning to improve the efficiency of road trips all over the world, including the U.S., Europe, and South America. In this post, I’d like to show you how we can use the exact same algorithm to optimize walking tours in large cities.

If you’re anything like me whenever you stop in a big city, you have a few main attractions that you’d like to visit and end up haphazardly spending half your day staring at maps and trying to figure out the public transit system.

However, by focusing on a limited few attractions, we’re missing out on dozens of interesting places that we could’ve visited along the way. This is where the route optimization algorithm can come into play again: If we hand the algorithm the list of popular attractions in a city, it can provide us an efficient walking tour around the city that hits all of those attractions.

Below, I’ve mapped out optimized walking tours for New York City and Philadelphia that hit the most popular attractions in each city according to TripAdvisor. These walking tours by no means represent the “definitive” walking tours for the cities, but both tours are guaranteed to give you a great taste of the cities while you’re there.

Optimized walking tour of New York City

If skyscrapers, museums, and large crowds are your gig, then this walking tour is for you. In 4.5 hours of walking, you’ll hit major sights like Central Park, Times Square, the Empire State Building, the Statue of Liberty, and more. This walking tour covers 14 miles of Manhattan, so come prepared with your walking shoes for what will add up to a half marathon.

Of course, if you want to stop and actually enjoy the sights along the way (which I strongly advise!), this tour could easily end up taking several days. Between long lines, hour-long museum tours, and frequent stops for Cronuts, you’ll likely only be able to hit a handful of stops per day before everything closes down. Keep that in mind when dividing this trip up over several days.

Click here for an interactive version

If 14 miles of walking sounds like too much, you can easily cut down on walking by taking the subway or bus for some of the longer legs of the trek. Or better yet, the same tour can be followed on a bike instead.

Here’s the Google Maps walking directions: [1] [2] [3]

Here’s the full list of attractions in order:

American Museum of Natural History, Central Park West, New York, NY The Metropolitan Museum of Art, 1000 5th Avenue, New York, NY 10028 The Frick Collection, East 70th Street, New York, NY Central Park, New York, NY The Museum of Modern Art (MOMA), West 53rd Street, New York, NY St. Patrick’s Cathedral, 5th Avenue, New York, NY Rockefeller Center, 45 Rockefeller Plaza, New York, NY 10111 Radio City Music Hall, Avenue of the Americas, New York, NY Theater District, New York, NY Times Square, New York, NY Bryant Park, New York, NY New York Public Library, New York, NY Chrysler Building, Lexington Avenue, New York, NY Grand Central Terminal, New York, NY The Morgan Library & Museum, Madison Avenue, New York, NY Empire State Building Observation Deck, 5th Avenue, New York, NY Madison Square Garden, Pennsylvania Plaza, New York, NY The High Line, New York, NY 10011 Chelsea Market, 9th Avenue, New York, NY Ground Zero Museum Workshop, West 14th Street, New York, NY Greenwich Village, New York, NY Washington Square Park, New York, NY SoHo, New York, NY Tenement Museum, Orchard Street, New York, NY St. Paul’s Chapel, Broadway, New York, NY The National September 11 Memorial & Museum, New York, NY 10006 Statue of Liberty

Optimized walking tour of Philadelphia

The Liberty Bell, cheese steaks, and obnoxious sports fans: These are some of the things that Philadelphia is widely known for. But did you know that Philadelphia is home to one of the largest urban park systems in the U.S.? Or that it’s home to America’s first zoo?

This 12-mile, 4-hour walking tour will take you through some of the best that Philadelphia has to offer, from beautiful parks to historic landmarks to breathtaking outdoor art collections. Again, don’t take this tour lightly, and plan to spend at least a few days in total enjoying the sights.

Click here for an interactive version

The same disclaimers from the NYC walking tour apply here: If 12 miles of walking sounds like too much, you can easily cut down on walking by taking public transit for some of the longer legs of the trek. Or better yet, the same tour can be followed on a bike instead.

Here’s the Google Maps walking directions: [1] [2] [3]

Here’s the full list of attractions in order:

Fairmount Park, Philadelphia, PA Please Touch Museum, 4231 Avenue of the Republic, Philadelphia, PA Philadelphia Zoo, West Girard Avenue, Philadelphia, PA Philadelphia Museum of Art, Benjamin Franklin Parkway, Philadelphia, PA Rocky Steps, Benjamin Franklin Parkway, Philadelphia, PA Eastern State Penitentiary, Fairmount Avenue, Philadelphia, PA Rodin Museum, Benjamin Franklin Parkway, Philadelphia, PA Barnes Foundation, 2025 Benjamin Franklin Parkway, Philadelphia, PA 19130 The Franklin Institute, North 20th Street, Philadelphia, PA Mutter Museum, South 22nd Street, Philadelphia, PA Penn Museum, 3260 South Street, Philadelphia, PA University of Pennsylvania, Philadelphia, PA Rittenhouse Square, Philadelphia, PA Cathedral Basilica of Saints Peter & Paul, Race Street, Philadelphia, PA Pennsylvania Academy Of The Fine Arts, North Broad Street, Philadelphia, PA Masonic Temple, North Broad Street, Philadelphia, PA Philadelphia City Hall, John F Kennedy Boulevard, Philadelphia, PA Reading Terminal Market, 51 N 12th St, Philadelphia, PA National Constitution Center, 525 Arch Street, Philadelphia, PA Fireman’s Hall Museum, North 2nd Street, Philadelphia, PA Elfreth’s Alley, Philadelphia, PA Christ Church, 20 North American Street, Philadelphia, PA National Museum of American Jewish History, Philadelphia, PA Independence National Historical Park, Philadelphia, PA Philadelphia’s Magic Gardens, South Street, Philadelphia, PA

Optimize your own walking tour

Undoubtedly, you’d like to pick your own stops in your own cities and optimize a walking tour around that. Well, you’re in luck!

If you’d like to customize your own walking tour, I’ve released the Python code I used in this project with an open source license and instructions for how to optimize your custom walking tour. If Google Maps can route in the city you want to take walking tour in, then this code will work for you.

You can find the code here.

Happy exploring!