DK for Delphi | GisLayerVector.TGIS_Shape.ImportFromWKT | Constructors | Fields | Methods | Properties
Replaces the current geometry by parsing Well-Known Text (WKT) in place.
// Delphi public procedure ImportFromWKT( const _wkt : String ); virtual;
// C++ Builder public: virtual void ImportFromWKT( const UnicodeString _wkt );
| Name | Type | Description |
|---|---|---|
| _wkt | String | WKT text such as POINT(10 20), LINESTRING(...), or POLYGON((...)). |
PURPOSE: Replaces the current shape geometry from WKT (Well-Known Text), the OGC (Open Geospatial Consortium) standard text representation for vector geometry.
BEHAVIOR: Parses the WKT content and updates this shape in place with the decoded geometry.
CONSTRAINTS: Existing geometry is overwritten. WKT does not carry CRS (Coordinate Reference System) metadata. Malformed input raises an exception.
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;