Member-only story
Plan Your Holiday With Python and HERE Maps
How to create your own map to visualize the places you want to visit
Summer is finally here. Are you up for a trip? This article is here to help you with the planning.
There are many tourist guides on the internet in which you can find a city’s top attractions. You could download a map and follow the suggestions. But what if you have a favorite topic and want to visit certain places?
In this tutorial, we’re going to see how to create our own map and mark the places we want to visit. This way, it will be easier to organize your days because you can visualize the places on the map. For example, you could group together the best breweries, candy shops, art museums, etc.
Let’s get started!
Prepare the Project
Collect a list of interesting places
First, let’s choose a travel destination. I’ve randomly chosen London for this example. Pubs will be our topic of interest, so I’ve gathered a list of the best ones.
Prepare the coordinates
Now, we have a list of pub names. I’ll use the geopy Python library to detect the coordinates.
Install the library by using pip
or pip3
:
pip install geopy
This is how to get the latitude and longitude of a specified location:
geolocator = Nominatim(user_agent="your_app_name")
location = geolocator.geocode("London")
print((location.latitude, location.longitude))(51.5073219, -0.1276474)
Mark the locations on the map
Now we have the coordinates and want to pin them on a map. You could use the Google Maps API to draw a map with the gmplot Python library. But since this API is not free, I’m going to show you an alternative: the HERE API.
The HERE API is a freemium tool that enables you to create custom maps, visualize location datasets, and much more. You can opt for a free plan and have up to 250K transactions per day, which should be enough for hobby projects.