Visualize query results

Analysis and business intelligence tools are crucial to helping you discover insights from your BigQuery data. BigQuery supports several Google and third-party data visualization tools that you can use to analyze the results of your queries on Places Insights data, including:

  • Looker Studio
  • BigQuery Geo Viz
  • Colab notebooks
  • Google Earth Engine

The example below describes how to visualize your results in:

  • Looker Studio, a platform that lets you build and consume data visualizations, dashboards, and reports.
  • BigQuery Geo Viz, a geospatial data visualization tool in BigQuery using Google Maps APIs.

See the BigQuery documentation for more information on visualizing your data using other tools.

Query data to visualize

The visualization examples below use the following query to generate a count of restaurants in New York City with a wheelchair accessible entrance. This query returns a table of restaurant counts per geographical point where the size of each point is 0.005 degrees.

Because you cannot perform a GROUP BY operation on a GEOGRAPHY point, this query uses the BigQuery ST_ASTEXT function to convert each point into the STRING WKT representation of the point, and writes that value to the geo_txt column. It then performs the GROUP BY using geo_txt.

SELECT
  geo_txt, -- STRING WKT geometry value.
  ST_GEOGFROMTEXT(geo_txt) AS geo, -- Convert STRING to GEOGRAPHY value.
  count
FROM (
  -- Create STRING WKT representation of each GEOGRAPHY point to
  -- GROUP BY the STRING value.
  SELECT WITH AGGREGATION_THRESHOLD
    ST_ASTEXT(ST_SNAPTOGRID(point, 0.005)) AS geo_txt,
    COUNT(*) AS count
  FROM
    `places_insights___us___sample.places_sample`
  WHERE
    'restaurant' IN UNNEST(types)
    AND wheelchair_accessible_entrance = true
  GROUP BY
    geo_txt
)

The following image shows an example output to this query where count contains the number of restaurants for each point:

Query results for of restaurants with wheelchair access in New York City.

Visualize data using Looker Studio

The following images show this data displayed in Looker Studio as a heatmap. The heatmap shows density from low (green) to high (red).

Query results displayed as a filled map and heatmap.

Import your data into Looker Studio

To import your data into Looker Studio:

  1. Run the query above in Query data to visualize.

  2. In the BigQuery results, click Open in -> Looker Studio. Your results are automatically imported into Looker Studio.

  3. Looker Studio creates a default report page and initializes it with a title, table, and bar graph of the results.

    Default report in Looker Studio.

  4. Select everything on the page and delete it.

  5. Click Insert -> Heatmap to add a heatmap to your report.

  6. Under Chart types -> Setup configure the fields as shown below::

    Heatmap setup in Looker Studio.

  7. The heatmap appears as above. You can optionally select Chart types -> Styles to further configure the appearance of the map.

Visualize data using BigQuery Geo Viz

The following images show this data displayed in BigQuery Geo Viz as a filled map. The filled map shows the restaurant density by point cell, where the larger the point corresponds to the higher density.

Query results displayed as a filled map in Geo Viz.

Import your data into BigQuery Geo Viz

To import your data into BigQuery Geo Viz:

  1. Run the query above in Query data to visualize.

  2. In the BigQuery results, click Open in -> GeoViz.

  3. The display opens to the Query step.

  4. Select the Run button to run the query. The map automatically shows the points on the map.

  5. Select Data to view the data.

  6. In the Data section, click the Add styles button.

  7. Select fillColor and then use the slider to enable Data-driven styling.

  8. Set the remaining fields as shown below:

    Filled map setup in Geo Viz.

  9. Click Apply Style to apply the styles to the map.