Vacation Locations

Pick your ideal destination with Computer Science!

Last reviewed and updated 3/20/2025

Picture this: You are planning to take a trip within the United States and you need to pick where you want to go. There are many fun and exciting places to visit, so it is really hard to choose! We are going to learn how to use computer science to make picking your ideal vacation spot a little easier.

Activity 1: Mapping Locations

For the first activity, you will be plotting a few interesting vacation spots on a map. We made a long list of possible vacation locations that we think you might be interested in. Plotting these locations on a map will make it easier to visualize where they are and help with your trip planning.

We have all of our vacation suggestions saved in a data file. Let's start with three of the locations: Yellowstone National Park, the Isabella Stewart Gardner Museum, and the World's Largest Ketchup Bottle.

Yellowstone National Park

Isabella Stewart Gardner Museum

World's Largest Ketchup Bottle

You can see the longitude and latitude for each of these locations in the table below.

Coordinates for three possible vacation locations

Task 1

Let's plot these locations on the map to the right so you can see where they are located! Let's start with finding Yellowstone National Park, which has the following longitude and latitude: -110.58850, 44.42800

  1. Click Search (lower right-hand corner of the map), and copy-paste the longitude and latitude values separated by a comma into the search bar at the upper left-hand side of the map.
  2. Hit enter to make the location appear on the map.
  3. Click Add to new sketch (or Add to sketch if you have that option) so that a point is added to the map at that location.
  4. Repeat the above three steps for the next two locations: (You may need to close the Sketch pane to search for a next location.)
    1. Isabella Stewart Gardner Museum: -71.099004, 42.338271
    2. Giant Ketchup Bottle: -89.982431, 38.662917

If it seems you are not in the right location, click Show more results in the pop-up to see new coordinate locations to use and then choose one of those locations. Sometimes the computer can get confused!

Reflection 1

How long did it take you to find and mark the 3 locations?

We have 45 locations picked out for you as potential vacation spots. Would you want to plot all of these by hand?

The good news is, you don't have to manually plot all 45 points. We can give the computer our list and let it plot everything for us!

Here is a table with all of our potential vacation locations:

Click the Run button to have the computer plot all of these points.

Reflection 2

How do you think that the computer knows where to plot the points on the map?

The computer knows because, like you, it plots the points based on the longitude and latitude. However, the computer is much faster than any of us. In fact, it takes longer for us to input three location points than it took the computer to plot everything.

Activity 2: Destination Types

Now that you can see where all of the potential destinations are, how might you figure out which one you want to visit? Maybe you can narrow your choices down by type of destination.

Try clicking on one of the points on the map to the right. In the pop-up, you can see the point's attributes, or the extra information associated with the point.

All of the destination points have 5 unique attributes:

  1. Name
  2. Category (National Park, Museum, or World's Largest)
  3. Latitude
  4. Longitude
  5. Links

Task 2

  • Try checking 5/10 points and see if you can remember which points are which type.
  • Check out one or two of the link to learn more about the locations.

Reflection 3

  • How difficult was it to remember the type of each of the points?
  • How long would it take you to check every point?
  • Do you think you could remember all of the point types yourself?
  • How might you help yourself remember which points are which?

Let's have the computer help us out again. We can use code to color the points on the map by their category attribute.

With the above code, we are making the category attribute visible on the map!

Now it is much easier to see which destinations are Museums, National Parks, or World's Largest.

      Now, we are going to tell the computer what type of trip we want to go on. Click one of the buttons to set the value of my_category_choice.

      my_category_choice =

      The computer is helping us narrow down our destination options!

      Reflection 4

      How do you think the computer knows which data points to keep and which ones to get rid of?

      Let's take a look at the code we used to have the computer only show one type of point on the map:

      This if/else structure is called a conditional statement. Our conditional statement has three parts:

      1. Evaluate whether a condition is true or false. In this case, our condition is whether a point's category attribute is the same as my_category_choice.
      2. If the condition is true, perform a task. In this case, if the condition is true, we keep the point on the map.
      3. Else, if the condition is false, perform a different task. In this case, if the condition is false, we take the point off of the map.

      Conditional statements are a very powerful tool in computer science. We can use them to tell computers how to make decisions.

      Activity 3: Measuring Distance

      You just narrowed down your vacation options by choosing a category. You can also narrow down your choices for your ideal vacation spot by the distance they are from Los Angeles, where you will be starting your vacation.

      Task 3

      1. First, you can make the map bigger by closing the Layers pane.
      2. On the map to the right, search for Los Angeles (you can search by name instead of latitude and longitude as we did above!) and add it to the map by clicking Add to new sketch when the address pops up.
      3. On the right-hand toolbar, click Map tools and click Measurement. A measure toolbar will appear. Verify the first icon is selected, which has a ruler and two arrows on it. Make sure you do not close the box.
      4. Click on Los Angeles and then move your cursor around the map.
      5. Double click anywhere on the map to place the second measurement point. When using this tool, the distance from Los Angeles to your cursor will appear in the Measure pane. Now, you can get a sense of how far other cities and states are from Los Angeles.
      6. Try measuring from Los Angeles to New York. Notice that the line is curved! This is because the earth is a sphere and we are representing it on a flat map.

      Feel free to explore by adding other points and measuring their distances from Los Angeles Think about how far you are willing to travel for your vacation: 500 miles? 1000 miles?

      Reflection 5

      How long did it take you to measure the distance from L.A. to one other location on the map? How long would it take if you were to measure the distance to each potential vacation spot from L.A.?

      If you were to do this by hand, you would have to select each vacation point and measure the distance between your starting location and that vacation location. You would then check if it is within your desired distance, just as you did above. However, since we have access to a computer, we can just ask the computer to do it!

      Pick a distance that you are willing to travel from Los Angeles for your vacation:

      max_distance =

      Reflection 6

      Wait a second! In Activity 2 you made choices based on attributes that were in our data file of locations, such as name, latitude, longitude, and category.

      In this section, we are using "distance from L.A.", which wasn't an attribute that we had access to. How did the computer figure out the distances?

      • Think about how you did the "measure" process above. Could the computer be doing something similar?
      • Click on a point on the map after you make a choice for max_distance. What new attribute does the point have?

      Just like you did with the "measure" tool, the computer checks the distance between each vacation spot and Los Angeles. It performs the following steps:

      1. Selects one location
      2. Calculates the distance between L.A. and that location
      3. Compares the calculated distance to the maximum distance you are willing to travel
      4. Repeats steps 1-3 for the rest of the locations

      Let's look at the code for this set of actions:

      What is going on here? The computer is looping through every vacation location data point and calculating its distance from L.A. The computer then uses the calculated distance to compare with the maximum distance you are willing to travel and keeps only the points that are closer than that distance from L.A. Looping is a very important computer science concept. It lets you tell the computer to repeat the same action many times, but you only have to give instructions to the computer once!

      Reflection 7

      Does the code above use a conditional statement (remember this uses the if/else structure)? Why might using both conditional statements and loops in the same piece of code be very powerful?


      Let's take another look at the code from Activity 2 (see below).

      Now that you've learned about loops, you might realize that only showing one category on the map also requires a loop. Once you made your category choice, the computer needed to loop through every location and decide whether or not to show the location. Below is the code from Activity 2 with a loop:

      A key takeaway is that if you want to make a choice and apply it to a lot of points, you can combine both conditionals and loops to make your life easier!

      Activity 4: Putting It All Together

      Great job! You’ve narrowed down your vacation options by category and distance. Now, let’s combine these two conditions to get all of your options that are of a particular category and within a certain distance of Los Angeles.

      We can combine the code that we’ve previously used and create a function. Let's make a function called pick_vacation. We are going to give this function two inputs: my_category_choice and max_distance.

      This is simply the code that we wrote above, but with both sections combined together! Note that we were able to combine both conditionals within the same loop! Let's try out the code now. Pick a combination of values for my_category_choice and max_distance:

      my_category_choice, max_distance =

      Now, we have a set of possible vacation locations in an instant!

      Task 4

      • Select a few points on the map and click on their links within the data attributes.
      • Pick the one you want to visit the most!

      Our pick_vacation function returns all of the points that are less than max_distance away from L.A. and are of your chosen category.

      All functions have the following structure:

      • A descriptive name and inputs
      • General code that uses the inputs
      • Outputs that change depending on the inputs

      Reflection 8

      • Why do you think functions are useful?

      Could we make even more functions, and make our code for pick_vacation even simpler?

      If we put the code from Activity 2 into a function called choose_by_category and the code from Activity 3 into a function called choose_by_distance we could rewrite pick_vacation as follows:

      Functions allow you to define a set of actions and then apply those actions to different inputs. This sort of reproducibility is what makes Computer Science very powerful.


      Key Concepts

      Congratulations on learning about the power of computer science through maps! Let's quickly review what we learned about:

      1. Automation - A computer can complete difficult tasks for you!
      2. Conditionals - You can teach a computer to make choices based on conditions!
      3. Looping - You can tell a computer to repeat certain actions again and again!
      4. Functions - You can make a box of code that contains a set of actions. You can then send inputs into the box to produce unique outputs!

      Next Steps

      Now that you know some basic computer science concepts, let's explore your narrowed-down vacation locations or practice writing functions (or both!). Click one of the buttons below to pick your next adventure!

      Functions for Dinner will allow you to take your new computer science skills and apply them to a similar problem: picking a restaurant to eat at while on vacation. You will write the function pick_restaurant and learn how to use it!

      Vacation Exploration will let you explore more of Esri's GIS tools. You will take a survey on your favorite vacation location and have the opportunity to explore other students' favorites.


      If you are interested in exploring either GIS or computer science concepts further, here are some cool resources about the power of computers and maps!

      To learn more GIS try these lessons:

      If you want to learn cool coding skills check out  code.org! 

      Coordinates for three possible vacation locations