Get startedGet started for free

Building map visualizations in Databricks

1. Building map visualizations in Databricks

Let's dive into a demo using the TPCH sample dataset available in Databricks. We'll focus on the customer and nation tables containing customer account balance data and corresponding geographical information. We begin by opening the 'SQL Editor' from the sidebar. We enter a query and save it as "1_2_demo". This query calculates the total account balance for all customers in each country, laying the groundwork for our visual exploration. After running the query, you'll see the raw results, including columns for the total account balance and country names. This data will serve as the foundation for creating meaningful visualizations. Now, let's create a map visualization, which is helpful when we want to visualize the impact of location on your data. Click the "+" icon next to the "Raw results", select "Visualization", and click it. In the card opened, choose the Visualization type as "Map (Choropleth)" We will choose Map type as "Countries", and select the "Country" as the Geographic column and "Full name" as the Geographic type. For the Value column, select "sum(c_acctbal)". Now, we see a preview on the right displaying color-coded aggregations categorized by geographic location. Regions with higher value intensities are shaded darker, while those with lower intensities are lighter. We can also hover over a specific country to view its corresponding value. Next, rename the Choropleth Map as "acctbal by country" and add the visualization to our main window. Similar to this, you can add and customize other map visualizations. Each map visualization type provides unique insights and helps convey different aspects of the story. That's all for now. Let's dive into some basic charts together in the upcoming exercises.

2. Let's practice!