We provide a set of examples that showcase how to easily create simple tilesets allowing you to process and visualize very large spatial datasets stored in BigQuery. You should use it if you have a dataset with any geography type (point, line, or polygon) and you want to visualize it at an appropriate zoom level.
COVID-19 vaccination progress in the USA (points)
In this example we are creating a tileset in which every inhabitant in the US is represented by means of a point. Each point is tagged with a vaccinated (blue) or non-vaccinated (purple) tag. This visualization enables us to depict at a glance which parts of the country are progressing better with the vaccination rollout.
The query used to produce the tileset is the following:
The CREATE_TILESET procedure implements smart memory management techniques that sample the data when needed in order to avoid hitting BigQuery’s memory limits.
Check out this blogpost to learn how we created this dataset and this visualization using the Analytics Toolbox and a custom application using CARTO for React.
United States roads by type (lines)
In this example we use a BigQuery public dataset from the United States Census Bureau to visualize all of the national roads in the US. The visualization is styled by the RTTYP route type code.
This dataset can be produced in a very straightforward manner by executing the next procedure:
( SELECT road_geom AS geom, route_type
WHERE route_type IS NOT NULL
NYC urban growth (polygons)
This example shows in a very effective manner the historical growth of New York City by means of the year of construction of its more than 800K buildings. The dataset has been obtained from the MapPLUTO repository of the NYC Department of City planning.
( SELECT geometry AS geom, YearBuilt
WHERE YearBuilt > 0
The visualization represents older buildings with lighter footprints and more recent ones with darker footprints.
FROM `carto-do-public-data.usa_acs.demographics_sociodemographics_usa_blockgroup_2015_5yrs_20142018` d
JOIN `carto-do-public-data.carto.geography_usa_blockgroup_2015` g
ON d.geoid = g.geoid
Checkout the result:
Zoom-dependant tileset for USA administrative units
You can create a tileset that uses different data sources depending on the zoom level. In this example, we are making use of the Data Observatory’s public datasets offering to create a visualization of the different administrative units in the US: the higher the zoom level, the higher the granularity of the administrative unit being shown.
This example uses the CREATE_SIMPLE_TILESET procedure. We strongly recommend to use CREATE_TILESET instead. Learn more here about the difference between the two procedures.
14 as zoom_min,
15 as zoom_max,
13 as zoom_min,
13 as zoom_max,
12 as zoom_min,
12 as zoom_max,
10 as zoom_min,
11 as zoom_max,
6 as zoom_min,
9 as zoom_max,
0 as zoom_min,
5 as zoom_max,
"skip_validation" : true,