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
  • 1. Derive the attractiveness score
  • 2. Derive the performance score
  • 3. Visualizing the results

Was this helpful?

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

Measuring merchant attractiveness and performance in CPG with spatial scores

Last updated 1 year ago

Was this helpful?

In the CGP industry, businesses are typically influenced by various factors that determine their success. It can be challenging to assess the attractiveness, risk, or trendiness of a merchant due to the multitude of criteria involved. Therefore, consolidating diverse data sources into a unified score becomes crucial for businesses to gain a comprehensive understanding of their product's potential in different locations. By doing so, they can develop clear strategies to optimize sales, boost profit margins, and effectively compete with other products in the market.

In this example, we will show you how to create spatial scores using for two different use cases:

  1. Understand how attractive each merchant is when it comes to selling a product. We will make use of the procedure to combine specific variables into a meaningful score and discover potential locations to bring a new beverage product to market.

  2. Identify how well each point of sales is performing to recognize areas of improvement. By using the procedure, we will detect if locations are performing as expected (or if they are under/over-performing) in terms of some business criteria and a performance KPI, such as sales, volume, or margin.

1. Derive the attractiveness score

  • the data we want to use to create the score,

  • the unique geographic identifier of each POS,

  • the output table name to store the results,

  • and some optional set up parameters. For this specific use case:

    • Using the weights option, we will assign a weight of 0.25 to the variables sentiment and footfall, as we believe they are the most relevant aspects for a POS to be successful in selling beverage. Therefore, the remaining 0.5 will be equally split among the other input features.

    • With the nbuckets parameter, we will categorize the merchants into 3 attractiveness levels ('Low', 'Medium' and 'High') of equal width.

CALL carto.CREATE_SPATIAL_SCORE(
    -- Select the merchant's unique identifier and the input features to be aggregated
    'SELECT pos_id, footfall, sentiment, positive_opinions_count, footfall_early_morning, footfall_early_afternoon, horeca_count_100m FROM `cartobq.docs.cpg_spatial_scoring_input`',
    -- Merchant's unique identifier variable
    'pos_id',
    -- Output table name
    '<my-project>.<my-dataset>.cpg_spatial_scoring_attractiveness',
    -- Optional parameters
    '''{
      "weights":{"sentiment":0.25, "footfall":0.25},
      "nbuckets":3
    }'''
);

The output table <my-project>.<my-dataset>.cpg_spatial_scoring_attractiveness includes the POS' locations (pos_id) ranked (ranking) based on the derived spatial attractiveness score (spatial_score) along with their corresponding attractiveness level (spatial_score_buckets). Notice that the score is provided on a 0-to-100 scale.

Additionally, a lookup table <my-project>.<my-dataset>.cpg_spatial_scoring_attractiveness_lookup is provided for the user to aid interpreting the attractiveness level. For instance, if a POS is very attractive to sell beverage, its score will lie within the 66.6 - 100 range.

Notice that this approach is also suitable to create spatial scores of any kind, such as risk or sales potential scores; what they represent depends on the input variables introduced by the user.

2. Derive the performance score

Now, we will use the same variables to run a regression model that estimates the expected performance of each FB-POS and then compare the results with the actual sales volumes. As a result, we will get a measure that allows us to detect locations above performance (over-performers) and below performance (under-performers) according to the specific business criteria that we have defined. Different criteria will yield different results.

  • Apart from the input data, the unique ID of each POS and the output table name, we need to specify also the business KPI variable. Particularly, we want to evaluate the performance of points of sales (POS) selling a beverage product based on a sales volume KPI that has been simulated for this purpose.

  • As optional parameters,

    • we want the R2 score of the regression model (r2_thr) to be 0.7 to ensure an acceptable fitting,

    • and the merchants will be categorized into 3 groups of equal widths centered at zero ('Low', 'Neutral' and 'High').

CALL carto.CREATE_SPATIAL_PERFORMANCE_SCORE(
    -- Select the merchant's unique identifier and the input features to be aggregated
    'SELECT pos_id, footfall, sentiment, positive_opinions_count, footfall_early_morning, footfall_early_afternoon, horeca_count_100m, sales_volume FROM `cartobq.docs.cpg_spatial_scoring_input`',
    -- Merchant's unique identifier variable
    'pos_id',
    -- Business KPI variable
    'sales_volume',
    -- Output table name
    '<my-project>.<my-dataset>.cpg_spatial_scoring_performance',
    -- Optional parameters
    '''{
      "r2_thr":0.7,
      "nbuckets":3
    }'''
);

Again, the output table <my-project>.<my-dataset>.cpg_spatial_scoring_performance includes the POS' locations (pos_id) ranked (ranking) based on the derived performance score (spatial_score) along with their corresponding performance level (spatial_score_buckets). Notice that the score is provided as the difference between the actual volume of sales and the estimated value (positive values indicate over-performance while negative values indicate under-performance, according to the selected criteria).

Additionally, a lookup table cartobq.docs.cpg_spatial_scoring_performance_lookup is provided as before to help interpretability. A POS with a score of 0 will always belong to the intermediate group, as the discretization is centered at 0. Notice that outliers are not considered when computing the upper and lower bounds of each bucket, but they belong to the closest bucket.

3. Visualizing the results

In the following maps we can see the results of computing both scores. To get more insights, one can for instance filter the data to select those FB-POS having a high performance on the left, and those FB-POS having a low attractiveness level on the right. It is interesting to see how some of the top performers have a low attractiveness score based on the selected business criteria. Such information can be used to further analyze possible causes and identify other success criteria than can be brought to new locations.

To derive both scores, we will consider Food & Beverage point of sales (FB-POS) from , enriched with business and financial information, sentiment scores and footfall indicators. Particularly, we will consider the footfall, sentiment and total amount of positive reviews of each POS, and the specific early morning and early afternoon footfall indicators, as these are the hours of peak beverage consumption. Lastly, we computed the amount of horeca POS (hotels, restaurants and cafés) in a 100 meters buffer around each FB-POS, computed by adding up all the horeca POIs contained within the resolution 11-H3 cell each FB-POS belongs to (using the procedure) and its 2nd-degree kring (using the procedure) as a proxy for faster performance.

To derive a score that measures how attractive a POS is to start selling a new beverage product, we will scale and aggregate the selected variables using some user-defined (optional) weights, which add up to 1. For this, we just need to call the procedure as follows. We need to specify:

To do this, we will call the procedure as follows:

The Data Appeal Company
H3_FROMGEOGPOINT
H3_KRING
CREATE_SPATIAL_SCORE
CREATE_SPATIAL_PERFORMANCE_SCORE
CARTO's Analytics Toolbox for BigQuery
CREATE_SPATIAL_SCORE
CREATE_SPATIAL_PERFORMANCE_SCORE
Advanced difficulty banner