User Tools

Site Tools


api:dk11:delphi:gislayervector.tgis_shape.createfromwkt_string

TGIS_Shape.CreateFromWKT method

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

Create the shape from a Well Known Text (see: www.opengis.org).

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

Syntax

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

Parameters

Name Type Description
_wkt String WKT text

Result

Type Description
TGIS_Shape Newly constructed object or nil.

Example

Delphi

var
  //public declarations
  layerObj : TGIS_LayerVector ;
  str : String = 'POLYGON((5 5,25 5,25 25,5 25,5 5),(10 10,10 20,20 20,20 10,10 10))';
 
procedure MyClass.WKT();
var
  shp : TGIS_Shape ;
begin
  try
    layerObj.RevertAll ;
    shp:=TGIS_Shape.Create(nil,nil,false,0,layerObj);
    layerObj.AddShape( shp.CreateFromWKT() ) ;
    shp.Free ;
  except
    ShowMessage( 'Bad format' ) ;
  end ;
 
  GIS.RecalcExtent ;
  GIS.FullExtent ;
  GIS.Invalidate ;
end;

References

2024/12/20 22:19

Page Tools