Unlocking Location Insights: A Guide to Extracting Point of Interest Data from Foursquare API

OCTAVE - John Keells Group
5 min readNov 20, 2023

What is point of interest data?

Point of interest (POI) data refers to information about specific locations or places of interest such as retail stores, hotels, restaurants, and tourist attractions. This data could include various attributes such as name, category, operating hours, customer reviews, opening hours and contact information of places.

Businesses can gain useful insights into customer behavior patterns and trends in various neighborhoods with the aid of POI data. Important learnings a company can derive from studying POI include:

· Identify high-traffic areas: By analyzing the frequency and duration of visits to certain POIs, businesses can identify areas with high foot traffic and use this information to target their marketing efforts.

· Understand consumer preferences: By analyzing the categories and attributes of POIs that consumers visit, businesses can gain insights into consumer preferences and tailor their products and services accordingly.

· Monitor competition: By tracking the locations and performance of competitor businesses, businesses can gain insights into their strengths and weaknesses and use this information to improve their own offerings.

· Optimize business operations: By analyzing POI data, businesses can optimize their operations, such as adjusting their opening hours or location to better serve customers.

There are various tools available for extracting POI data such as Google places API, OpenStreetMap, Foursquare API, Yelp API and ArcGIS. Each of these tools have their pros and cons hence it is important to select the appropriate tool based on our requirements. The focus of this article will be on the use of Foursquare API.

What is Foursquare API and how to use it?

Foursquare API is a platform that provides developers with access to location-based data and to build location-based applications. This API offers both free and paid services, the free service plan provides access to basic location data such as venue names, addresses, geo-location and sometimes access to venue photos. This article will be only focusing on the POI data provided by the free plan.

A Step-by-step guide to getting started with the Foursquare developer API:

1. First, we need to create a developer account: Go to https://developer.foursquare.com/ and click on the “Get Started” button. Follow the prompts to create your account.

2. Once you create an account, you will be able to access the developers’ homepage as shown below.

3. Next, you can click on the ‘Create New Project’ button and provide an organization and a project name you prefer.

4. Once you have created a new project, you will be redirected to the project’s settings page. In the settings page you will find a button to generate an API key.

5. Click on the ‘Generate API Key’ and provide a name for the API Key. This will generate a new API key, please make sure to copy the key and save it somewhere where you can access it later.

Once the above steps are complete, we will be able to extract POI data using the API key.

Example on how to use the Foursquare API with Python

Let’s look an example of extracting places of interests around few interesting neighborhoods in Colombo district, Sri Lanka.

· Cinnamon Gardens

· Union Place

· Thimbirigasyaya

· Bambalapitiya

First, let’s extract the geo coordinates of the neighborhoods that we need information about. For this purpose, we could use the geocoder python library.

For the Foursquare places API search, we can input various parameters such as the names of the required venues, category of the venues, the distance to the venue from the location we input and etc. All available parameters for this API are listed in the following link; https://location.foursquare.com/developer/reference/place-search

For this example, we will only use two parameters:

· radius — Sets a radius distance (in meters) used to define an area to bias search results. The maximum allowed distance is 100,000 meters.

· limit — The number of results to return, maximum is up to 50. Defaults is set to 10.

Let’s look at all the available venues (up to 50) within 1km radius from our interested suburbs.

As shown above the results from the API search will in a form a dictionary, hence it is important to organize the results to match with our suburbs.

From all venue data, only the venue name, venue category and the venue geo coordinates were extracted to the final table.

In conclusion, the Foursquare API is an invaluable resource for conducting geospatial analysis. By leveraging the Foursquare Places API, analysts and researchers can gain a deeper understanding of consumer behavior, spatial patterns, and trends.

So why not explore the possibilities today and see what you can discover with the Foursquare Places API?

--

--

OCTAVE - John Keells Group

OCTAVE, the John Keells Group Centre of Excellence for Data and Advanced Analytics, is the cornerstone of the Group’s data-driven decision making.