DEV Community

Cover image for Leveraging Kaggle for Free Geographical Data: A Guide to Integrating with PostGIS via QGIS
Fady Shafeek
Fady Shafeek

Posted on

Leveraging Kaggle for Free Geographical Data: A Guide to Integrating with PostGIS via QGIS

In today's data-driven world, access to quality geographical data is crucial for a wide range of applications, from urban planning to environmental monitoring. While obtaining such data may seem daunting, platforms like Kaggle offer a treasure trove of freely available datasets waiting to be explored. In this article, we'll walk through the process of acquiring real geographical data from Kaggle, loading it into QGIS as a CSV layer, and seamlessly integrating it with PostGIS for advanced spatial analysis.

1. Prepare Data from Kaggle Datasets:

  • Navigate to Kaggle Datasets (https://www.kaggle.com/datasets) and explore the vast collection of available datasets.
  • Use the search functionality to find geographical datasets relevant to your area of interest. Whether it's demographic data, transportation networks, or environmental parameters, Kaggle likely has what you need.
  • Select a dataset that suits your project requirements and download it in CSV format. Ensure that the dataset contains geographical attributes such as latitude and longitude or shapefiles for spatial analysis.

in this article we will use Riyadh Restaurants Dataset

Image description

Then download it

Image description

Image description

2. Open QGIS and And Add your Basemap:

  • You can Access Tabaqat's free basemaps (https://platform.tabaqat.net/base-maps) to enhance the visual representation of your geographical data for Saudi Arabia within QGIS.
  • Tabaqat offers a variety of basemap styles, including street maps, satellite imagery, and terrain maps, enabling you to choose the most suitable backdrop for your analysis.
  • Integrate the Tabaqat basemap with your QGIS project to provide context to your geographical data and facilitate spatial interpretation.

Image description

Then Copy the WMTS URL Note Optain your access_token by signing up and replace it on url before using it for example

Image description
https://basemaps.tabaqat.net/styles/bright-arabic-ksa-boundary/wmts.xml?access_token=YOUR-ASSESS-KEY => https://basemaps.tabaqat.net/styles/bright-arabic-ksa-boundary/wmts.xml?access_token=tabaqat-13uPaas5bdT6IW-xxxxxx

Then add the basemap to your QGIS Project

Image description

Image description
Congrats

Image description

3. Add CSV as a Layer:

  • Launch QGIS, Create new project.
  • Use the 'Add Layer' button to import the CSV file you

Image description

Navigate to the downloaded dataset in file name input and select your file

Image description

Your Data is Ready

Image description

4. Load Data to PostGIS:

  • PostGIS, an extension of PostgreSQL, is a spatial database that allows for advanced storage, retrieval, and analysis of geographical data.
  • Before loading data into PostGIS, ensure that you have PostgreSQL and PostGIS installed on your system or you can Get Free PostGIS Hosted on the Cloud From SupaBase, check this article for more info: (https://dev.to/fady-shafeek/how-to-get-free-postgres-if8).

Image description

then enter your credential and test the connection

Image description

Now Drag and Drop Time!!

Image description

Congrats your data imported to PostGIS Successfully!

Top comments (0)