User Tools

Site Tools


samples:samples:addlayer

Table of Contents

AddLayer sample

Documentation | Samples | AddLayer

Summary

AddLayer sample — demonstrates dynamic layer addition and visual parameter configuration.

Description

What the sample shows:

  • Programmatically creating a TGIS_LayerSHP instance for vector data
  • Adding layers to the viewer via GIS.Add() method
  • Using GisCreateLayer factory to auto-detect layer type from file extension
  • Setting visual rendering parameters: fill colour, line width, outline, line colour
  • Disabling automatic .ttkgp config-file loading with UseConfig property
  • Applying customised parameters so layers display as explicitly configured
  • Fitting viewport to all loaded layers with GIS.FullExtent()
  • Switching viewer interaction modes: Drag (pan) vs. Select (click features)
  • Zooming programmatically by scaling current Zoom value up/down

This is a very basic sample. Probably the first sample we ever created.

This sample illustrates use of:

Name Description
TGIS_Layer.ParamsParameters (colors, fills, etc.) object.
TGIS_Layer.PathPath to file holding the layer's data.
TGIS_LayerSHPLayer that can read SHP file.
TGIS_Layer.ParamsParameters (colors, fills, etc.) object.
TGIS_Viewer.AddAdd a layer to the Viewer.
TGIS_Utils.GisCreateLayerCreate a layer given by a name.

Code

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

2026/06/08 21:59

Page Tools