New supplier offices based on store locations clusters
Requirements
To run this example you'll need:
The latest version of the Analytics Toolbox Core Native App installed in your Snowflake database
Optional: An active CARTO organization to visualize the results in a map
Example
In this example we are going to use points clustering to analyze where to locate 10 new supplier offices in US so they can best serve all Starbucks locations.
Generating the clusters
First, we calculate Starbucks locations clusters using the ST_CLUSTERKMEANS
function:
This query gathers the geometries of the Starbucks locations in order to establish clusters and then groups the different geometry clusters. Each of them is represented in a different colour in the following visualization.
Calculating the clusters' centers
Once we have split the sample of points into clusters, we can easily work with them to calculate their centers, envelopes, concave/convex hulls and other different transformations. In this particular example we are interested in finding the center of the clusters, since that is where we are going to place the offices. The Analytics Toolbox offers different functions for this task, for example ST_CENTERMEAN
, ST_CENTERMEDIAN
and ST_CENTEROFMASS
.
In this case we are going to use ST_CENTEROFMASS
to calculate the location of the new offices:
We can see the result in the following visualization, where the bigger dots represent the supplier offices locations we have decided to open based on our analysis.
Last updated