User Tools

Site Tools


api:dk11:delphi:gislayervector.tgis_shape.createfromewkt_string

Table of Contents

TGIS_Shape.CreateFromEWKT method

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

Create the shape geometry from an Extended Well-Known Text (EWKT) representation of the geometry with SRID meta data. (see www.postgis.org).

Available also on: .NET | Java | ActiveX | Python.

Syntax

// Delphi
public
  function CreateFromEWKT(
    const _ewkt : String
  ) : TGIS_Shape; virtual;
// C++ Builder
public:
  virtual TGIS_Shape* CreateFromEWKT(
    const UnicodeString _ewkt
  );

Parameters

Name Type Description
_ewkt String EWKT text

Result

Type Description
TGIS_Shape Newly created shape.

Example

Delphi

var
  //public declarations
  layerObj : TGIS_LayerVector ;
  str : String = 'SRID=4326;POLYGON((5 5,25 5,25 25,5 25,5 5),(10 10,10 20,20 20,20 10,10 10))';
 
procedure MyClass.EWKT();
var
  shp : TGIS_Shape ;
begin
  try
    layerObj.RevertAll ;
    shp:=TGIS_Shape.Create(nil,nil,false,0,layerObj);
    layerObj.AddShape( shp.CreateFromEWKT() ) ;
    shp.Free ;
  except
    ShowMessage( 'Bad format' ) ;
  end ;
 
  GIS.RecalcExtent ;
  GIS.FullExtent ;
  GIS.Invalidate ;
end;
2022/11/16 01:22

Page Tools