LogoLogo
HomeDocumentationLoginTry for free
  • CARTO Academy
  • Working with geospatial data
    • Geospatial data: the basics
      • What is location data?
      • Types of location data
      • Changing between types of geographical support
    • Optimizing your data for spatial analysis
    • Introduction to Spatial Indexes
      • Spatial Index support in CARTO
      • Create or enrich an index
      • Work with unique Spatial Index properties
      • Scaling common geoprocessing tasks with Spatial Indexes
      • Using Spatial Indexes for analysis
        • Calculating traffic accident rates
        • Which cell phone towers serve the most people?
    • The modern geospatial analysis stack
      • Spatial data management and analytics with CARTO QGIS Plugin
      • Using data from a REST API for real-time updates
  • Building interactive maps
    • Introduction to CARTO Builder
    • Data sources & map layers
    • Widgets & SQL Parameters
    • AI Agents
    • Data visualization
      • Build a dashboard with styled point locations
      • Style qualitative data using hex color codes
      • Create an animated visualization with time series
      • Visualize administrative regions by defined zoom levels
      • Build a dashboard to understand historic weather events
      • Customize your visualization with tailored-made basemaps
      • Visualize static geometries with attributes varying over time
      • Mapping the precipitation impact of Hurricane Milton with raster data
    • Data analysis
      • Filtering multiple data sources simultaneously with SQL Parameters
      • Generate a dynamic index based on user-defined weighted variables
      • Create a dashboard with user-defined analysis using SQL Parameters
      • Analyzing multiple drive-time catchment areas dynamically
      • Extract insights from your maps with AI Agents
    • Sharing and collaborating
      • Dynamically control your maps using URL parameters
      • Embedding maps in BI platforms
    • Solving geospatial use-cases
      • Build a store performance monitoring dashboard for retail stores in the USA
      • Analyzing Airbnb ratings in Los Angeles
      • Assessing the damages of La Palma Volcano
    • CARTO Map Gallery
  • Creating workflows
    • Introduction to CARTO Workflows
    • Step-by-step tutorials
      • Creating a composite score for fire risk
      • Spatial Scoring: Measuring merchant attractiveness and performance
      • Using crime data & spatial analysis to assess home insurance risk
      • Identify the best billboards and stores for a multi-channel product launch campaign
      • Estimate the population covered by LTE cells
      • A no-code approach to optimizing OOH advertising locations
      • Optimizing site selection for EV charging stations
      • How to optimize location planning for wind turbines
      • Calculate population living around top retail locations
      • Identifying customers potentially affected by an active fire in California
      • Finding stores in areas with weather risks
      • How to run scalable routing analysis the easy way
      • Geomarketing techniques for targeting sportswear consumers
      • How to use GenAI to optimize your spatial analysis
      • Analyzing origin and destination patterns
      • Understanding accident hotspots
      • Real-Time Flood Claims Analysis
      • Train a classification model to estimate customer churn
      • Space-time anomaly detection for real-time portfolio management
      • Identify buildings in areas with a deficit of cell network antennas
    • Workflow templates
      • Data Preparation
      • Data Enrichment
      • Spatial Indexes
      • Spatial Analysis
      • Generating new spatial data
      • Statistics
      • Retail and CPG
      • Telco
      • Insurance
      • Out Of Home Advertising
      • BigQuery ML
      • Snowflake ML
  • Advanced spatial analytics
    • Introduction to the Analytics Toolbox
    • Spatial Analytics for BigQuery
      • Step-by-step tutorials
        • How to create a composite score with your spatial data
        • Space-time hotspot analysis: Identifying traffic accident hotspots
        • Spacetime hotspot classification: Understanding collision patterns
        • Time series clustering: Identifying areas with similar traffic accident patterns
        • Detecting space-time anomalous regions to improve real estate portfolio management (quick start)
        • Detecting space-time anomalous regions to improve real estate portfolio management
        • Computing the spatial autocorrelation of POIs locations in Berlin
        • Identifying amenity hotspots in Stockholm
        • Applying GWR to understand Airbnb listings prices
        • Analyzing signal coverage with line-of-sight calculation and path loss estimation
        • Generating trade areas based on drive/walk-time isolines
        • Geocoding your address data
        • Find similar locations based on their trade areas
        • Calculating market penetration in CPG with merchant universe matching
        • Measuring merchant attractiveness and performance in CPG with spatial scores
        • Segmenting CPG merchants using trade areas characteristics
        • Store cannibalization: quantifying the effect of opening new stores on your existing network
        • Find Twin Areas of top-performing stores
        • Opening a new Pizza Hut location in Honolulu
        • An H3 grid of Starbucks locations and simple cannibalization analysis
        • Data enrichment using the Data Observatory
        • New police stations based on Chicago crime location clusters
        • Interpolating elevation along a road using kriging
        • Analyzing weather stations coverage using a Voronoi diagram
        • A NYC subway connection graph using Delaunay triangulation
        • Computing US airport connections and route interpolations
        • Identifying earthquake-prone areas in the state of California
        • Bikeshare stations within a San Francisco buffer
        • Census areas in the UK within tiles of multiple resolutions
        • Creating simple tilesets
        • Creating spatial index tilesets
        • Creating aggregation tilesets
        • Using raster and vector data to calculate total rooftop PV potential in the US
        • Using the routing module
      • About Analytics Toolbox regions
    • Spatial Analytics for Snowflake
      • Step-by-step tutorials
        • How to create a composite score with your spatial data
        • Space-time hotspot analysis: Identifying traffic accident hotspots
        • Computing the spatial autocorrelation of POIs locations in Berlin
        • Identifying amenity hotspots in Stockholm
        • Applying GWR to understand Airbnb listings prices
        • Opening a new Pizza Hut location in Honolulu
        • Generating trade areas based on drive/walk-time isolines
        • Geocoding your address data
        • Creating spatial index tilesets
        • A Quadkey grid of stores locations and simple cannibalization analysis
        • Minkowski distance to perform cannibalization analysis
        • Computing US airport connections and route interpolations
        • New supplier offices based on store locations clusters
        • Analyzing store location coverage using a Voronoi diagram
        • Enrichment of catchment areas for store characterization
        • Data enrichment using the Data Observatory
    • Spatial Analytics for Redshift
      • Step-by-step tutorials
        • Generating trade areas based on drive/walk-time isolines
        • Geocoding your address data
        • Creating spatial index tilesets
Powered by GitBook
On this page
  • Context
  • You will need...
  • 1 Establish an area of study
  • 2 Pizza Huts locations in Honolulu
  • 3 Polyfill area of study
  • 4 Enriching the grid
  • 5 Processing the enriched data
  • 6 Calculate the minimum distance to a Pizza Hut
  • 7 Find suitable locations
  • 8 Competitor analysis
  • 9 Visual analysis

Was this helpful?

Export as PDF
  1. Advanced spatial analytics
  2. Spatial Analytics for BigQuery
  3. Step-by-step tutorials

Opening a new Pizza Hut location in Honolulu

Last updated 2 months ago

Was this helpful?

Context

Identifying an optimal location for a new store is not always an easy task, and we often do not have enough data at our disposal to build a solid model to predict potential revenues across an entire territory. In these cases, managers rely on different business criteria in order to make a sound decision for their expansion strategy. For example, they rely on defining their target market and segmenting population groups accordingly in order to locate the store closer to where the target market lives (e.g. areas with a great presence of youngsters).

You will need...

You will need to subscribe to two public datasets from the Data Observatory:

You can adapt this analysis for any country or similar use case by replacing these inputs with demographic and POI inputs relevant for your analysis.

1 Establish an area of study

  1. Head to the Workflows tab of the CARTO Workspace and create a new workflow with any Google BigQuery connection.

  2. Head to Sources > Data Observatory and location each of the above datasets (Nodes and Sociodemographics) in turn, and drag them on to the canvas for later.

  3. We will start by defining an area of interest for our study; in our case we will simply switch from the Sources to Components tab, and locate the Draw Features component. Drag it onto the canvas, select Draw Features in the dialog box on the right and draw a study area. We're drawing a polygon with a roughly 5km radius around Honolulu - but you can draw this for anywhere in the United States.

Prefer to use SQL?
SELECT ST_BUFFER(ST_GEOGPOINT(-157.852587, 21.304390), 5000) AS geom

2 Pizza Huts locations in Honolulu

  1. Drag a Spatial Filter component onto the Canvas. Set the top input as Nodes, and the bottom as your study area.

  2. Connect this to an Unnest component, so we can access the data in the all_tags array field. Run the workflow.

  3. With the data unnested, connect the Unnest component to a Where component, using the condition key = 'brand' AND value = 'Pizza Hut'.

  4. Run again! The result will be all Pizza Huts in our study area.

Prefer to use SQL?
WITH honolulu_buffer AS (
    SELECT ST_BUFFER(ST_GEOGPOINT(-157.852587, 21.304390), 5000) AS geom
)

SELECT 
    tag.value AS brand, 
    d.geometry 
FROM 
    `carto-data.ac_xxxxxx.carto_openstreetmap_pointsofinterest_nodes_gbr_latlon_v1_quarterly_v1` AS d,
    -- remember to replace ac_xxxxxx with your Data Observatory connection ID 
    honolulu_buffer
CROSS JOIN UNNEST(d.all_tags) AS tag 
WHERE 
    ST_CONTAINS(honolulu_buffer.geom, d.geometry) 
    AND tag.key = 'brand' 
    AND tag.value = "Pizza Hut"

3 Polyfill area of study

  1. On a separate branch to the Spatial Filter we just used, connect your Draw Features component to a H3 polyfill component. Set the resolution to 10 which is a finer resolution than the default. You may wish to alter this depending on your use case and study area size.

  2. Run!

Prefer to use SQL?
WITH 
    honolulu_buffer AS (SELECT ST_BUFFER(ST_GEOGPOINT(-157.852587, 21.304390), 5000) AS geom)

SELECT h3
    FROM unnest(`carto-un`.carto.H3_POLYFILL(
    (SELECT geom
    FROM honolulu_buffer), 10)) h3   

4 Enriching the grid

Our customer is interested in looking for areas with a high density residents under 30 years old who do not have an existing Pizza Hut restaurant nearby.

  1. Drag an Enrich H3 Grid component onto the canvas.

  2. Set the H3 polyfill as the top input - this is our target layer.

  3. Set Sociodemographics as the bottom input - this is our source layer.

  4. Set the aggregation variables as the 10 fields with male and female populations aged between 18 and 29. Set the aggregation type to SUM.

  5. Run!

Prefer to use SQL?

Please note the below CALL procedure can only be undertaken from your BigQuery console; not the CARTO Builder SQL Console.

CALL `carto-un`.carto.DATAOBS_ENRICH_GRID
('h3',
R'''
WITH 
    honolulu_buffer AS (SELECT ST_BUFFER(ST_GEOGPOINT(-157.852587, 21.304390), 5000) AS geom)
SELECT h3
    FROM unnest(`carto-un`.carto.H3_POLYFILL(
    (SELECT geom
    FROM honolulu_buffer), 10)) h3   
''',
'h3',
[('female_15_to_17_eb1658f1', 'sum'), ('female_18_to_19_6d791436', 'sum'), ('female_20_f727dc', 'sum'),
('female_21_77f0174a', 'sum'), ('female_22_to_24_121a63e5', 'sum'), ('female_25_to_29_a90c21d6', 'sum'),
('female_30_to_34_50344313', 'sum'), ('male_15_to_17_8dd9d9ac', 'sum'), ('male_18_to_19_bb6956b', 'sum'),
('male_20_5264b51', 'sum'), ('male_21_72217bc7', 'sum'), ('male_22_to_24_74d5e2b8', 'sum'),
('male_25_to_29_cfc3a08b', 'sum'), ('male_30_to_34_36fbc24e', 'sum')],
NULL,
['yourproject.yourdataset.honolulu_pizza_aos_enriched'],
'carto-data.ac_xxxxxxxx');

You can see the results of this enrichment below.

5 Processing the enriched data

We are going to process our resulting enriched table to aggregate all the male and female population variables and store the result into a single column.

  1. Connect the Enrich H3 grid component to a Create Column component. Call the new field sum_pop and input the following:

  male_18_to_19_bb6956b_sum +
  male_20_5264b51_sum +
  male_21_72217bc7_sum +
  male_22_to_24_74d5e2b8_sum +
  male_25_to_29_cfc3a08b_sum +
  female_18_to_19_6d791436_sum +
  female_20_f727dc_sum +
  female_21_77f0174a_sum +
  female_22_to_24_121a63e5_sum +
  female_25_to_29_a90c21d6_sum

6 Calculate the minimum distance to a Pizza Hut

Now your workflow should be looking something like this:

  1. Connect the Where component from section 2 to a H3 from Geopoint component, setting the resolution to 10.

  2. Drag a Cross Join component onto the canvas. Connect the H3 from Geopoint component to the top input, and the Create Column component to the bottom input. Run this - you will now have a table which joins all combinations of features from both tables.

  3. Connect this to a H3 Grid Distance component, setting the input fields as H3 and H3_joined respectively.

  4. Now, connect this to a Group by component:

    1. Set the group field as H3_joined (i.e. the H3 field from the grid covering your study area).

    2. Set the aggregation fields as sum_pop_joined (AVG) and h3_distance (MIN).

The result of this will be a H3 table containing a field with the population and distance to the closest Pizza Hut.

Prefer to use SQL?
WITH 
  honolulu_buffer AS (
    SELECT ST_BUFFER(ST_GEOGPOINT(-157.852587, 21.304390), 5000) AS geom
  ),

  t1 AS (
    SELECT 
      `carto-un`.carto.H3_FROMGEOGPOINT(geometry, 10) AS h3id
    FROM 
      `cartobq.docs.honolulu_planet_nodes` d,
      UNNEST(all_tags) AS tag
    WHERE 
      ST_CONTAINS((SELECT geom FROM honolulu_buffer), geometry)
      AND tag.value IN ("Pizza Hut")
      AND tag.key = 'brand'
  ),

  t2 AS (
    SELECT * 
    FROM `yourproject.yourdataset.honolulu_pizza_aos_enriched_sum`
  )

SELECT 
  t2.h3id, 
  ANY_VALUE(t2.sum_pop) AS sum_pop, 
  MIN(`carto-un`.carto.H3_DISTANCE(t2.h3id, t1.h3id)) AS dist
FROM 
  t1
CROSS JOIN 
  t2
WHERE 
  sum_pop IS NOT NULL
GROUP BY 
  t2.h3id;

7 Find suitable locations

Now, we are going to identify areas that meet Pizza Hut requirements, i.e., locations with large populations aged 15-34 and far from existing Pizza Hut restaurants. We will do this by calculating hotspots for both of these variables.

  1. Connect Group by to a Hotspot Analysis component. Set the following parameters:

    1. Column with the unique identifier: H3_joined

    2. Input variables: columns containing population and distance values

    3. Weights: 0.7, 0.3. Your weights should total 1, be comma separated and written in the order of your input variables.

    4. K-ring: 3.

    5. Significance level: 0.01

Prefer to use SQL?
CALL `carto-un`.carto.COMMERCIAL_HOTSPOTS(
  'yourproject.yourtable.honolulu_pizza_aos_enriched_sum_wdist',
  NULL,
  'h3',
  'h3',
  ['sum_pop_joined_avg','h3_distance_min'],
  [0.7, 0.3],
   3,
   0.01
);

8 Competitor analysis

  1. Move back up the workflow to the Unnest component from section 2. Connect this to a Where component on a new branch of the workflow. Set the condition for this as key = 'amenity' AND value IN ('fast_food', 'restaurant').

  2. At present, Local Outlier Factor is not available as a component in Workflows, so we will need to call the Analytics Toolbox function via SQL. Connect Where to a Custom SQL Select, ensuring you connect to the topmost input. Enter the following SQL code to call the function:

WITH 
lof_output 
AS(SELECT `carto-un`.carto.LOF(ARRAY_AGG(STRUCT(geoid,geom)), 5) as lof 
FROM `$a`
)
SELECT lof.* FROM lof_output, UNNEST(lof_output.lof) AS lof

9 Visual analysis

Now, let's bring all of that analysis together on a map to make a decision! You can select any component in Workflows, open the Map preview (bottom of the screen) and select Create Map to add it to a new Builder map.

However, all workflows results are temporary files which are stored for 30 days. If you want to commit a table permanently, you should use a Save as Table component to save to your lakehouse.

In the map below, we can explore the hotspots from our analysis (pink areas) which would be ideal locations for a new Pizza Hut store. Additionally, we can compare this with the distribution of competitors (orange points).

In this example, we are going to use CARTO’s Analytics Toolbox for BigQuery to explore find the best location to open a new Pizza Hut restaurant in Honolulu, Hawaii. For that, we will perform two different spatial analyses based on spatial indices (H3): and .

We'll be using CARTO Workflows to run the majority of this analysis by creating the below pipeline. If you're new to this part of CARTO, we recommend heading the the section of the Academy to familiarize yourself.

from OpenStreetMap. We will use this to establish the locations of both our store and our competitor stores. Learn more about using OpenSteetMap data .

from the American Community Survey. We'll use this to identify the strength of our target market.

Next, we will find all Pizza Hut restaurants in Honolulu using , available through CARTO’s Data Observatory.

For our upcoming statistical analysis, we will subdivide the area of study into H3 grid cells of resolution 10 using the function. You can learn about the benefits of using Spatial Indexes like H3 .

To perform the demographics analysis, we are going to enrich the H3 grid of our area of interest with a set of population variables from the , available for free through our . We will make use of the of CARTO’s Analytics Toolbox.

If you get stuck in any of the steps of this process, please refer to , where you will find an example notebook that performs an enrichment using Data Observatory data that you can run using your own BigQuery account.

In addition to the population, Pizza Hut would like to consider for the analysis the distance to the closest existing Pizza Hut as they would like to avoid cannibalization between their own restaurants. For that, for every cell of our grid we are going to compute the distance to every Pizza Hut restaurant using the function, and then keep the minimum value. Please note that these distances are computed as the number of H3 cells of resolution 10 that separate a pair of locations, and therefore are only an approximation.

Learn more about hotspot analysis in our .

Finally, we are going to extract Pizza Hut’s competitors from the OpenStreetMap nodes table and compute the local outlier factor (using the function) to identify those that are very close to one another and those far from the others. This will give us an additional insight to decide where it would be the ideal location to open a new restaurant. You can find a full guide to Local Outlier Factor analysis .

Commercial Hotspots
Local Outlier Factor
Creating Workflows
Nodes - United States of America
here
Sociodemographics, 2018, 5yrs - United States of America (Census Block Group)
OpenStreetMaps’s Planet Nodes dataset
H3_POLYFILL
here
ACS Sociodemographics dataset at census block group level
Data Observatory
enrichment capabilities
this guide
H3_DISTANCE
guide
LOF
here
Opening a new Pizza Hut location in Honolulu - the full workflow
Drawing custom features
Filtering OSM nodes to Pizza Huts in Honolulu
Running H3 Polyfill
Enriching the grid
Getting there!
Calculating the minimum distance
Running hotspot analysis
Opening a new Pizza Hut location in Honolulu - the full workflow
Advanced difficulty banner
A screenshot of CARTO Builder
A screenshot of CARTO Workflows
A screenshot of CARTO Workflows
A screenshot of CARTO Workflows
A screenshot of CARTO Workflows
A screenshot of CARTO Workflows
A screenshot of CARTO Workflows
A screenshot of CARTO Workflows
A screenshot of CARTO Builder