# Spatial data management and analytics with CARTO QGIS Plugin

The [**CARTO QGIS Plugin**](https://docs.carto.com/data-and-analysis/carto-qgis-plugin) seamlessly integrates desktop **GIS workflows with cloud-native spatial** **analytics**, allowing users to connect, access, visualize, edit, and sync spatial data from data warehouses between QGIS and CARTO.

While CARTO excels in analytics and visualization of large-scale geospatial data running natively on cloud data warehouse platforms, certain data management tasks—such as geometry editing and digitization—are better suited for desktop GIS tools like QGIS.

In this tutorial, you will learn how to use the CARTO QGIS Plugin to enhance your geospatial processes. Using a telecom network planning example, you will connect QGIS to your data warehouses through CARTO, edit geometries based on an image provided by the urban department, and sync updates seamlessly with CARTO. Finally, you will create an interactive map to review potential sites alongside relevant datasets while keeping the information updated as new edits are made in QGIS.

By the end of this tutorial, you will have a fully integrated process between QGIS and CARTO, ensuring efficient spatial data management in a cloud-native environment.

{% hint style="info" %}
**Important considerations**:&#x20;

In this tutorial, we will be using:

* **QGIS Version:** 3.34.15-Prizren
* **CARTO QGIS Plugin Version:** 0.92.2
  {% endhint %}

## **Step-by-Step Guide:**

In this guide, we'll walk you through:

* [Installing the CARTO QGIS Plugin](#installing-the-carto-qgis-plugin)
* [Authorizing CARTO in QGIS](#authorizing-carto-in-qgis)
* [Browsing and accessing your data](#browsing-and-accessing-your-data)
* [Georeferencing images in QGIS](#georeferencing-images-in-qgis)
* [Editing geometries and pushing changes to your data warehouse](#editing-geometries-and-pushing-changes-to-your-data-warehouse)
* [Extracting insights using Builder](#extracting-insights-using-carto-builder)

***

## Installing the CARTO QGIS Plugin

To get started, **install the CARTO QGIS** **Plugin** in your QGIS Desktop application. If you don't have QGIS yet, it is an open-source GIS desktop application that can be downloaded [here](https://qgis.org/download/).&#x20;

1. Open QGIS desktop and start a new project.
2. Navigate to *Plugins > Manage and Install Plugins*.
3. Click on the Not Installed tab and search for "CARTO".
4. Select CARTO QGIS Plugin and click Install.
5. Once installed, you should see the CARTO Plugin in the top toolbar and the Browser panel.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2F7IH4Qbj1mBjnDG4S5eTG%2Fimage.png?alt=media&#x26;token=650087d6-2ec2-46ff-9daf-8ee8c0478baa" alt=""><figcaption></figcaption></figure>

***

## Authorizing CARTO in QGIS

Now, you need to **log in to your CARTO account** to connect your cloud-hosted spatial data with QGIS.

1. Locate the CARTO Plugin in the QGIS interface (in the Plugins section or Browser panel).
2. Click on Log In to CARTO.
3. Enter your CARTO credentials to securely authenticate your account.
4. If you don't have a CARTO account yet, you can [sign up for a free trial](https://app.carto.com/signup).

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2Fkhc3Cqb10wagehgL2aqH%2Fimage.png?alt=media&#x26;token=c845facb-53ad-4b8b-828f-6ff10c46cfe0" alt=""><figcaption></figcaption></figure>

After successfully logging in, a confirmation screen will appear, indicating that the **CARTO QGIS Plugin** is now connected and ready for use.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FpJrBocbFk2FCFShzBh2q%2Fimage.png?alt=media&#x26;token=d491922b-1af6-466b-a08d-e9d8e25750b5" alt=""><figcaption></figcaption></figure>

***

## Browsing and accessing your data

With CARTO authorized, you can now browse and load datasets from your cloud data warehouse directly into QGIS.

1. In the **QGIS Browse**r panel, locate CARTO Connections. If you don’t see your Browser, activate it via *View → Panels → Browser*.
2. You’ll see your available datasets and tables from your organization’s data warehouse.
3. Click on a dataset to preview its structure and metadata.
4. You can download the entire table or apply filters (WHERE statements, spatial filters, row limits)

{% hint style="info" %}
**Permissions:**

* Your ability to edit datasets depends on your **user permissions** in your data warehouse.
* If you don’t have an editable table to follow this tutorial, you can **create one** or **import sample data** using [CARTO’s import functionality](https://docs.carto.com/carto-user-manual/data-explorer/importing-data), either to your own connection or to the Private dataset in [CARTO Data Warehouse](https://docs.carto.com/carto-user-manual/connections/carto-data-warehouse).
  {% endhint %}

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2Fzx8buUX5hJ5SBvUK3vCq%2Fimage.png?alt=media&#x26;token=eeaa860b-de0d-4630-9b6f-9a29c7ec2564" alt=""><figcaption></figcaption></figure>

***

## Georeferencing images in QGIS

In some cases, geospatial data is unavailable, and all you have is an **image or a scanned document**. This is where **QGIS’s georeferencing capabilities** become essential.

In this scenario, you’ve received a PDF containing a newly proposed redevelopment site, which needs to be added to the list of potential sites for review next year. Since this redevelopment area comes from the urban department, there is no existing geospatial dataset available—only a .png image of the site.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2F1GYyAJC3UhrpJjFYyCxT%2Fimage.png?alt=media&#x26;token=f1ab3c0b-81d7-4b82-8a24-42461398d849" alt=""><figcaption></figcaption></figure>

1. **Take a screenshot** of the above image and save it as .png.
2. **Add your image** as a Raster layer:
   * Click on Data Source Manager → Raster.
   * Upload the .png image.
   * Click Add to display it in QGIS.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FLLPbcQ5tpM32tQMWAH2q%2Fimage.png?alt=media&#x26;token=eeca4910-fae9-427c-be9c-bac7a6c8f08f" alt=""><figcaption></figcaption></figure>

2. Click Zoom to Layer(s) to confirm the image was added.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FxR5ULMZUYZZtNO1llTul%2Fimage.png?alt=media&#x26;token=d3de62e7-c376-49de-aa72-8cc1c35705fc" alt=""><figcaption></figcaption></figure>

3. Use the **Georeferencer** tool:
   * Go to *Layer → Georeferencer*.
   * In the Georeferencer modal, add the raster image.
   * The image will now appear in the Georeferencer canvas.

     &#x20;

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FhnASM6TunplOrwxg4lhQ%2Fimage.png?alt=media&#x26;token=e6533286-6aef-49c3-9cb6-b93be3ce2500" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FVzb9iDbfMS18HWKaL3LJ%2Fimage.png?alt=media&#x26;token=7a98bc76-0dd9-4622-bdd9-6d30920d31ae" alt=""><figcaption></figcaption></figure>

4. **Define control points**:
   * Select Add Point and mark at least four control points.
   * Click Map Canvas to introduce coordinates.
   * Click on the correct location in the main map canvas.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FapxGz5hIF8E3trYuXxmZ%2Fimage.png?alt=media&#x26;token=d859d1cb-8825-4d94-a5c6-b078a849f177" alt=""><figcaption></figcaption></figure>

6. **Run the Georeferencing** process:
   * Define an output file name and set transformation settings.
   * Click Run to execute.
   * The georeferenced raster file will now appear in the correct location.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FKJlYhwTBJUSxpYRFjdms%2Fimage.png?alt=media&#x26;token=660d69bf-12bc-4489-94db-e19d7d2fc3bd" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FqXEtn7YAMpIol8IMn9ph%2Fimage.png?alt=media&#x26;token=2d42780d-7c1f-4987-8799-daf2dd6482ac" alt=""><figcaption></figcaption></figure>

***

## Editing geometries and pushing changes to your data warehouse&#x20;

Now, we will edit an existing CARTO table to include the newly digitized site for network expansion planning.

1. In the **QGIS Browser**, locate an editable table (e.g., `planned_regions_2025`) within your CARTO connection.&#x20;

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FFc0lDEzIS6BzRXPjWOCM%2Fimage.png?alt=media&#x26;token=8477852c-6d4a-4882-a70c-24db3fa6e778" alt=""><figcaption></figcaption></figure>

2. Click **Add Layer** or use **Add Layer Using Filter** if you want to download a subset of your data.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FHELFVZASZuPZ6zdWjLKq%2Fimage.png?alt=media&#x26;token=aa37ac54-b0a9-4b38-895a-c78844314156" alt=""><figcaption></figcaption></figure>

3. Once loaded, **start an editing session** by clicking the pencil icon in the Editing Toolbar.
4. Use the **Add Polygon** tool to digitize the new redevelopment site.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FpOrAnkEtHrF4E6ods5u4%2Fimage.png?alt=media&#x26;token=64d35c01-77d0-4127-983f-b41bb023eba7" alt=""><figcaption></figcaption></figure>

5. Once finished, right-click to complete the geometry.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FXh1Oe3oKPIxpezcuHnGz%2Fimage.png?alt=media&#x26;token=4a6ed30c-a617-4e37-9244-df6989292624" alt=""><figcaption></figcaption></figure>

6. **Enter the feature attributes** (e.g., site name, classification, priority).

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FkMbt4pgxIMYApR8rr1eJ%2Fimage.png?alt=media&#x26;token=7b65130d-fd61-43a4-84ec-ae8908d432f8" alt=""><figcaption></figcaption></figure>

7. Click **Save** to upload the changes back to your data warehouse through CARTO. If your table does not contain a geoid storing a unique identifer, you'll be prompted with a modal to define your primary key. Please make sure this stores a unique identifer so your edits can be successfully and correctly uploaded.&#x20;

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FXbXTKCqmDoew4XKDvpCy%2Fimage.png?alt=media&#x26;token=976b2754-5ab0-4f5b-b0a1-dd340dd2acb7" alt=""><figcaption></figcaption></figure>

8. Go to your CARTO platform, naviage to **CARTO Data Explorer** to confirm the uploaded feature. The new **Port Lands Redevelopment** site should now appear.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2Fr9dA6oZCWoevOBdsVk5d%2Fimage.png?alt=media&#x26;token=6f10f1ae-d0e1-451a-a95b-2bb134106541" alt=""><figcaption></figcaption></figure>

***

## Extracting insights using CARTO Builder

Now that your data is synchronized and available in your data warehouse, you can leverage the powerful features of the CARTO platform to create interactive and insightful dashboards.&#x20;

1. In CARTO Workspace, navigate to Data Explorer and locate your table. In here you should be able to have a preview of both the data and the map. From this interface, click on **Create map**. This will open a new tab with Builder displaying this data source.&#x20;

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FrA6KK3qoY97TaNmAEz3w%2Fimage.png?alt=media&#x26;token=e6425b14-cc94-4038-9113-6e70962ce140" alt=""><figcaption></figcaption></figure>

[**Builder**](https://academy.carto.com/building-interactive-maps/introduction-to-carto-builder) is CARTO map-making tool that allows you to create scalable web map applications leveraging the data warehouse capabilities. Let's create our interactive dashboard.&#x20;

2. Let's give your map a name, "Toronto - Planned regions for 202&#x35;*"*.
3. After that, we'll rename our layer to "Planned Regions" and style them accordingly so the regions stand out on the map visualization. In our case, we'll set the **Fill Color** and **Stroke Colo***r* to `light and dark orange`. Then, set the **Stroke Width** to `2.`

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FYFFKdIcRDwHnib2eUFot%2Fimage.png?alt=media&#x26;token=770d2141-3c98-4c1c-a97c-a5637d66c58d" alt=""><figcaption></figcaption></figure>

4. Let's add **Toronto's census** data source. To do so, follow the next steps:&#x20;

* Select the **Add 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. To add Toronto's census data source, run the query below:&#x20;

```
SELECT * FROM `cartobq.docs.toronto_census_population` 
```

5. Rename the newly added layer to "Census population" and set the **Fill Color** based on `Total_population` property using a `light to dark blue` palette. Set the **Opacity** for the **Fill Color** to `20` and the **Opacity** for the **Stroke Color** to `10`.&#x20;

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FbijGCflYFelo9XZx20bA%2Fimage.png?alt=media&#x26;token=89c99da7-babc-4094-ba36-21c283e4e9e8" alt=""><figcaption></figcaption></figure>

6. In the main layer panel, change the position of the layer to the bottom, so that Planned regions layer stay on top of the visualization.&#x20;

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FuWMlBNNTfZiGQllmtmzE%2Fimage.png?alt=media&#x26;token=82225136-e4b3-49c9-a857-a16ac7d665d4" alt=""><figcaption></figcaption></figure>

7. Now, we'll add a final dataset, the **road network for Toronto**, to have visibility on the major roads that are likely to be impacted by this project. To do so, add a custom SQL query and run the following query, as per previous source. This query contains a `WHERE rank < 5` that will allow us to dynamically obtain just major roads in this location.

<pre class="language-sql"><code class="lang-sql"><strong>SELECT * FROM  `cartobq.docs.toronto_road_network` WHERE rank &#x3C; 5
</strong></code></pre>

8. Name this layer "Road network" and style the **Stroke Color** based on its `Rank` property, from `light to dark pink`. Also, set the **Opacity** to `40` .Then, set the **Stroke Width** to `2`.&#x20;

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FqvaYU5roq3Sz8qwdMJMi%2Fimage.png?alt=media&#x26;token=1725a4fa-7a10-43bd-963b-3493b56da53f" alt=""><figcaption></figcaption></figure>

We have now finished adding our sources, now let's add some functionality to our dashboard that will allow users to dynamically extract information by leveraging pop-up interactions and charts.

9. Navigate to the **Interactions** section, and set the properties for each layer as below:

* *Road Network*:
  * `name`
  * `type`
  * `rank`
* *Planned regions*: `All`
* *Census Population:*&#x20;
  * `Total_population`

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FcmfCZPWDseTLuMXiV1ef%2Fimage.png?alt=media&#x26;token=934f74d7-6307-4bee-9060-2afccd160c93" alt=""><figcaption></figcaption></figure>

10. Now let's include some [**Widgets**](https://academy.carto.com/building-interactive-maps/widgets-and-sql-parameters) to extract insights and allow users to filter data. To do so, navigate to the Widgets tab and include the following widgets:

* **Formula Widget**:
  * Source: `Census population`
  * Widget name: `Total Population`
  * Operation: `SUM(Total_population)`
  * Formatting: `12.3k`
  * Behaviour: `Filter by viewport`
* **Pie Widget:**
  * Source: `Planned regions`
  * Widget name: `Region Status`
  * Operation: `status`
  * Behaviour: `Filter by viewport`
* C**ategory Widget 1**:
  * Source: `Planned regions`
  * Widget name: `Region Name`
  * Operation: `Region_name`
  * Behaviour: `Filter by viewport`
* **Category Widget 2**:
  * Source: `Road network`
  * Widget name: `Road Network Type`
  * Operation: `Type`
  * Behaviour: `Filter by viewport`

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FSin4xdw5iNetoQqqXZRY%2Fimage.png?alt=media&#x26;token=173cce5b-4c67-49ab-a853-9e4fbc716fce" alt=""><figcaption></figcaption></figure>

11. Before publishing our map, we'll configure our [**Data Sources Freshness**](https://docs.carto.com/carto-user-manual/maps/data-sources/managing-data-freshness). The data source freshness will determine how up-to-date the data sources in the map are at its initial load. This will ensure users will be able to extract insights always as fresh as you configure this. In our case, we'll set Data Freshness to `5 minutes`. So if further changes are done, for example more sites are digitized in QGIS using CARTO QGIS Plugin, they will reach our map automatically once is loaded.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FwKbrQxBYnFKuCGi6xUak%2Fimage.png?alt=media&#x26;token=af0296b0-1d45-4c27-9fd3-f262f5a6e698" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FthYFdd3d2ijVJw1qs9VP%2Fimage.png?alt=media&#x26;token=87ff4623-245a-4b59-9bd9-93930a932826" alt=""><figcaption></figcaption></figure>

12. Finally, we're ready to share the map with others. Let's go to the **Preview mode**, to ensure the map is looking as expected. To do so, click on Preview next to the Share button. A different layout appears that displays the application as if you were the end-user accessing it.&#x20;

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FYVkMCI90Cz0OdoK2y8WN%2Fimage.png?alt=media&#x26;token=ba70a801-560f-457e-bdb7-51d0637e5234" alt=""><figcaption></figcaption></figure>

13. Once you are happy with the dashboard, click on **Share** and set it to shared with your specific users, SSO groups, your entire organizaiton or publicly.

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FnU3nX67zgUd9uYUKBs0G%2Fimage.png?alt=media&#x26;token=98181872-7f4a-4b45-9a68-7119b637db2c" alt=""><figcaption></figcaption></figure>

Congrats, you're done! The final results should look similar to the below:

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FBgSNA3X0rD3Zsq4tLSej%2Fimage.png?alt=media&#x26;token=6a5b9d43-17c4-409a-b9da-d07cd5aae15a" alt=""><figcaption></figcaption></figure>

Learn more about crafting impactful visualizations in the [Building Interactive Maps](https://academy.carto.com/building-interactive-maps) section of the Academy.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://academy.carto.com/working-with-geospatial-data/the-modern-geospatial-analysis-stack/spatial-data-management-and-analytics-with-carto-qgis-plugin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
