Official Content

Returns the WKT representation of a Geography, GeoPoint, GeoLine, or GeoPolygon data type.

Syntax

AttOrVar.ToWkt()

Where:

AttOrVar  
    Is an attribute or variable based on the Geography data type (or derived data types associated with geometry like GeoPoint, GeoLine, GeoPolygon) containing the data to be converted to a WKT representation.

Type Returned:
Character
    Is a valid representation of a Point, Line, or Polygon in WKT format.

Scope

Data Types:  Geography, GeoPoint, GeoLine, GeoPolygon  
Generators: .NET.NET FrameworkJavaAppleAndroid


Description

The ToWkt method can be applied to an attribute or variable based on the Geography data type (or derived data types associated with geometry like GeoPoint, GeoLine, or GeoPolygon) and returns the corresponding representation in WKT format.

Samples

&WKTChar=&Geography.ToWkt()

&WKTChar=&GeoPoint.ToWkt()

&WKTChar=&GeoLine.ToWkt()

&WKTChar=&GeoPolygon.ToWkt()

 

Consider the following Transaction object:

Place
{
  PlaceId* 
  PlaceName --> Character data type
  PlaceGeo --> Geography data type
}

The following code can be defined, for example, in a Procedure object:

Rules:
Parm(&PlaceId);

Source:
For each Place 
    where PlaceId = &PlaceId
       &WKTChar = PlaceGeo.ToWkt()  //&WKTChar is based on the Character data type
       //do something with &WKTChar
endfor

Suppose that &PlaceId = 10. When executing the For Each command and filtering the record where PlaceId = 10, the stored PlaceName is 'Cristo Redentor, Rio de Janeiro, Brazil,' and when applying the ToWkt() method to the PlaceGeo attribute, the &WKTChar variable will be loaded as follows:

"POINT(-43.2105 -22.9519)"

See Also

FromWkt method

 

Last update: March 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant