User Tools

Site Tools


samples:samples:sqllayeradvanced

Table of Contents

SQLLayerAdvanced sample

Documentation | Samples | SQLLayerAdvanced

Summary

SQLLayerAdvanced sample — demonstrates advanced SQL database layer operations and styling (Delphi/VCL).

Description

What the sample shows:

  • Creating and attaching vector layers from spatial SQL databases
  • Supporting multiple database backends (SQLite, PostGIS, SQL Server, MySQL)
  • Loading layers from persistent .ttkls configuration files
  • Applying layer styles from style repositories
  • Managing project definitions stored in databases
  • Querying available styles and projects from the database
  • Displaying SQL layers in the viewer with custom styling
  • Handling spatial data attributes and filtering
  • Editing and saving layer styles to database
  • Creating new SQL layer connections programmatically
  • Managing layer visibility and transparency
  • Handling database connection parameters and authentication

In .NET it is necessary to manually attach ADODB file to the sample. ADODB file is located in “Deployment” folder.

Edit gistest.ttkls to provied your database access You can use *.ttkls as any other layer (for example open in editor).

This sample illustrates use of:

Name Description
TGIS_LayerVectorSqlAbstract.CreateStyleTableCreate the table used to store layer styles in the database.
TGIS_LayerVectorSqlAbstract.WriteStyleWrite or update a style in the database.
TGIS_Viewer.ProjectFileProject file itself as opened in Open procedure.
TGIS_Viewer.SaveProjectAsExSave the current project under a new name.
TGIS_LayerVector.ImportLayerImport shapes from another vector layer, optionally filtered by extent, target geometry type, and SQL (Structured Query Language) WHERE clause.
TGIS_Config.GetStringsFills a string list with configuration content.
TGIS_Config.SetLayerSelects the layer whose configuration section will be used.
TGIS_ConfigFactory.CreateConfigCreates a config instance based on the path extension.
TGIS_LayerSqlSqlite.BuildInitialize layer path, extent, and default coordinate dimensionality for a vector layer build operation.

Code

This sample is available on the following platforms (click to view the source code on GitHub):

2026/09/21 00:22

Page Tools