User Tools

Site Tools


api:dk11:delphi:gislayervector.tgis_shape.importfromwkt_string

Table of Contents

TGIS_Shape.ImportFromWKT method

DK11 for Delphi | GisLayerVector.TGIS_Shape.ImportFromWKT | Constructors | Fields | Methods | Properties

Import the Well Known Text (see www.opengis.org) into the current shape.

Available also on: .NET | Java | ActiveX.

Syntax

// Delphi
public
  procedure ImportFromWKT(
    const _wkt : String
  ); virtual;
// C++ Builder
public:
  virtual void ImportFromWKT(
    const UnicodeString _wkt
  );

Parameters

Name Type Description
_wkt String WKT text

Remarks

Internally it uses CreateFromWKT method. If WKT is a different type, the shape will be reset.

Example

Delphi

const
  WKTText='POLYGON((15 15,25 15,25 25,15 25,15 15),(10 10,10 20,20 20,20 10,10 10))';
var
  layerObj : TGIS_LayerVector ;
 
procedure MyClass.Shape();
var
  shp : TGIS_Shape ;
begin
  layerObj.RevertAll ;
 
  try
    // create a shape using WKT string
    shp:=layerObj.CreateShape(TGIS_ShapeType.Polygon);
    shp.ImportFromWKT( WKTText ) ;
  except
    ShowMessage( 'Bad format' ) ;
  end ;
 
  GIS.RecalcExtent ;
  GIS.FullExtent ;
  GIS.Invalidate ;
end;
2020/05/07 01:09