# Build a dashboard with styled point locations

<div align="left"><figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2F8iAlvj1s2Th85m6IvcG5%2Fbeginner%20banner.png?alt=media&#x26;token=10e8f40a-3632-4920-87c3-6b0dca2a6775" alt="Beginner difficulty banner" width="175"><figcaption></figcaption></figure></div>

## **Context**

Understanding population distribution has important implications in a wide range of geospatial analysis such as human exposure to hazards and climate change or improving geomarketing and site selection strategies.

In this tutorial we are going to represent the distribution of the most populated places by applying colours to each type of place and a point size based on the maximum population. Therefore, we can easily understand how the human settlement areas is distributed with a simple visualization that we can use in further analysis.

## **Steps To Reproduce**

1. Access the *Maps* section from your CARTO Workspace using the Navigation menu and create a new Map using the button at the top right of the page. This will open the Builder in a new tab.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FUld0dj8RRDc9Vql7rzoN%2Fimage.png?alt=media&#x26;token=7662d7a2-723c-4610-936e-248f8ad290a4" alt=""><figcaption></figcaption></figure>

2. Let's add populated places source. To do so, follow the next steps:&#x20;
   * Select the A*dd source from* button at the bottom left on the page.&#x20;
   * Select *Custom Query (SQL)* and then *Type your own query* under the *CARTO Data Warehouse* connection.
   * Click on the *Add Source button*.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FXODojcxUK5iyAVcSx5Mx%2Fimage.png?alt=media&#x26;token=1fcb3b93-8d90-46e8-b493-91984d307bbc" alt=""><figcaption></figcaption></figure>

The SQL Editor panel will be opened.&#x20;

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FpYGnx7FoBGWdIl8Q7wQr%2Fimage.png?alt=media&#x26;token=8d329b44-5d65-4a20-81b1-52c6bdc5002d" alt=""><figcaption></figcaption></figure>

To add populated places source, run the query below:&#x20;

```sql
SELECT * FROM `carto-demo-data.demo_tables.populated_places`
```

3. Change the layer name to "Populated Places". Click over the layer card to start styling the layer.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FNUrmawhePa9mjGCk7s5O%2Fimage.png?alt=media&#x26;token=2e621df8-700f-40a2-ac00-1208b66f8680" alt=""><figcaption></figcaption></figure>

4. In the **Fill Color**, we will use the 'Color based on' functionality to color by `featurecla`. It has information about what kind of places there are, so we will pick a **palette for a categorical variable** (versus a gradient). Additionally, we will remove the **Stroke Color** so we are able to differentiate the different categories.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2Fao4BZOrPIKtygH6j3FVr%2Fimage.png?alt=media&#x26;token=aeff26e8-7a89-40ad-9081-aa9cea64390a" alt=""><figcaption></figcaption></figure>

5. Now click on the options for the **Radius** configuration and in the section “Radius Based On” pick the column `pop_max`. Play with the minimum/maximum size to style the layer as you like.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FpUTuGI5HcNZJPdCDKr0E%2Fimage.png?alt=media&#x26;token=9c50cb2b-0899-49ca-b2d0-671cdc091b54" alt=""><figcaption></figcaption></figure>

6. Go to Widget tab and click on 'New widget' to add a new Widget for "populated\_places" source.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2F3KFVVH6KGymVUXxywNiU%2Fwidget1.gif?alt=media&#x26;token=1369b3e8-4fb8-48ed-bc9f-4d246d0382e5" alt=""><figcaption></figcaption></figure>

7. Select the **Category widget**, choose `COUNT` as the operation method and select the column `admin0name`. Then, rename your widget to 'Populated places by country'.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FbiGL3G9vaad8s8ZdKBp3%2Ftutorial1_1.gif?alt=media&#x26;token=9788a4ea-e921-4ce0-8e5d-c3e3b991147a" alt=""><figcaption></figcaption></figure>

8. Using the Category widget on the right panel, select “United States of America” to filter out the rest of countries. You can also lock your selection to ensure the selection is not removed by mistake.
9. Let's now add another widget, this time a **Pie widget** based on `featurecla`. We will add a **Markdown note** for this widget to provide users with further information about each category type. We will also set the behaviour mode of this widget to **global**, so the represented date is for the whole dataset without it being affected by the viewport intersection.&#x20;

```markdown
**Percentage of Populated Places by Type**

This chart shows the distribution of various types of populated places, each representing a unique category:

- **Populated Place**: General areas with a concentration of inhabitants, such as towns or cities.
- **Admin-0 Capital**: Primary capital cities of countries, serving as political and administrative centers.
- **Admin-1 Capital**: Capitals of first-level administrative divisions, like states or provinces.
- **Admin-0 Region Capital**: Important cities that are the administrative centers of specific regions within a country.
- **Admin-1 Region Capital**: Major cities that serve as the administrative centers of smaller regions within first-level divisions.
- **Admin-0 Capital Alt**: Alternative or secondary capitals in countries with more than one significant administrative center.
- **Scientific Station**: Locations established for scientific research, often in remote areas.
- **Historical Place**: Sites of historical significance, often tourist attractions or areas of cultural importance.
- **Meteorological Station**: Facilities focused on weather observation and data collection.

*Each category in this chart gives insight into the diversity and function of populated areas, providing a deeper understanding of the region's composition.*
```

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2F18gti1CfeIQqhyy904ij%2Ftutorial1_2.gif?alt=media&#x26;token=7f90d30d-a80b-424b-b27e-6c483997e4f4" alt=""><figcaption></figcaption></figure>

10. Finally, we will rename this widget to 'Places by type' and move it to the top of the Widgets panel by dragging the card on the left panel.&#x20;
11. The third and final widget we will add to our dashboard is a **Histogram widget** using `pop_max` column. This will allow users to select the cities based on the population. Finalise the widget configuration by setting the **buckets limit** to `10` and **formatting** the data to be displayed. Finally, rename the widget to 'Max population distribution'.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2F66hctJWC6bwfI62fmXlF%2Ftutorial1_3.gif?alt=media&#x26;token=01c32e4d-6f7a-4635-9327-322ca0a40b13" alt=""><figcaption></figcaption></figure>

12. Interactions allow users to gather information about specific features, you can configure this functionality in the Interaction panel. First, select the **type of interaction** to `Click` and `Info Panel`. Then, add the attributes you are interested in, renaming and changing the formatting as needed.&#x20;

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2F486dlTs1JIksljMcTEEC%2Ftutorial1_4.gif?alt=media&#x26;token=8265f53c-f6dd-49a1-a3b6-17105c469cf3" alt=""><figcaption></figcaption></figure>

13. Finally we can change our **basemap**. Go to Basemaps tab and select “Dark matter” from CARTO.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2F9WY0WBgY8YC608xnq7hh%2Fbasemaps.gif?alt=media&#x26;token=8ddcd88c-b524-42fa-b530-b3144721b964" alt=""><figcaption></figcaption></figure>

14. Rename the map to “Populated Places”.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FIO86j3UnG0zx14mXGHLM%2Fimage.png?alt=media&#x26;token=41132d8c-7e28-412c-8a0d-886e02fdbe94" alt=""><figcaption></figcaption></figure>

15. Add a **map description** that will allow users understand the nature of your map.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FGlKcll1mcI88NJ3KKZwt%2Ftutorial1_5.gif?alt=media&#x26;token=8e45fbad-6e82-40a9-bde3-442afc653033" alt=""><figcaption></figcaption></figure>

```markdown
### Populated Places 

![Image: Replace with your own](https://insert-image-url-here.com)

Explore a world map that categorizes populated places by type, each color-coded for quick reference. It highlights the link between population density and administrative roles.

**Data Insights**  
  
Notice the dense capitals signifying political and economic hubs, contrasted with isolated scientific stations. Each point's size indicates the maximum population, adding a layer of demographic understanding.

**How to Use It**  
  
📊 Examine the charts for a country-wise breakdown and population details. 

📌 Click on points for specifics like population peaks and elevation.

🌎 Dive in and engage with the map for a closer look at each location. 

```

16. We can **make the map public** and share it online with our colleagues. For more details, see [Publishing and sharing maps](https://docs.carto.com/carto-user-manual/maps/publishing-and-sharing-maps).

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FnazCCO5gz6Aa9Bu25eMB%2Fimage.png?alt=media&#x26;token=1a2d1fb4-106f-4b66-b647-4d56f7c6fd39" alt=""><figcaption></figcaption></figure>

Finally, let's export our map into a portable, easy-to-share PDF.&#x20;

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FSOBfdtoUksRHFaD573sm%2FCARTOexportmaptoPDF-crop.gif?alt=media&#x26;token=b5246216-c395-4fea-b011-bd49957a7710" alt=""><figcaption></figcaption></figure>

17. In the window that appears, select **Include map legend**. You can also include comments here (such as the version number or any details about your approval process). In the **Share** drop-down menu, select **Download PDF Report**.&#x20;
18. Select **Preview**, and when you're happy **Download PDF Report**.&#x20;

{% embed url="<https://clausa.app.carto.com/map/9b1dc487-d93d-4e3a-9a3c-71242365ed66>" %}
