Official Content

Loads data into an attribute or variable based on the Geography data type (or derived data types associated with geometry like GeoPoint, GeoLine, GeoPolygon) from a representation in WKT format.

Syntax

AttOrVar.FromWkt(Character)

Where:

AttOrVar  
    Is an attribute or variable based on the Geography data type (or derived data types associated with geometry like GeoPoint, GeoLine, GeoPolygon) to which the data will be loaded.

Character  
    Is text enclosed in quotation marks that must contain a valid representation of a Point, Line, or Polygon in WKT format. For example,

  • To load a Point, Character should be: "POINT(Longitude Latitude)"
  • To load a Line or Multiline, Character should be: "LINESTRING(Longitude1 Latitude1, Longitude2 Latitude2, Longitude3 Latitude3)"
  • In the case of a Polygon, Character should be: "POLYGON(Longitude1 Latitude1, Longitude2 Latitude2, Longitude3 Latitude3, .....)"

    Longitude, Longitude1, Longitude2, Longitude3 are Longitude Coordinates and Latitude, Latitude1, Latitude2, Latitude3 are Latitude Coordinates. 
    
    For more details about the WKT (Well Known Text) format, refer to: https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry

Type Returned:
Geography | GeoPoint | GeoLine | GeoPolygon

Scope

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


Description

The FromWkt method receives a representation in WKT format (Longitude coordinates and Latitude coordinates must always be indicated in that order in the character content) to load attributes or variables based on the Geography data type (or derived data types associated with geometry like GeoPoint, GeoLine, GeoPolygon).

Samples

1) &Geography is a variable based on the Geography data type. &Point is a variable based on the GeoPoint data type. They are being loaded, for example, inside an object Event or an object Source.

&Geography.FromWkt("POINT(-56.163740158081055 -34.92478600243492)")

or:

&Point.FromWkt("POINT(-56.163740158081055 -34.92478600243492)")

2) AttractionGeography is an Attribute based on the Geography data type that is being updated for a certain attraction received as a parameter. The For Each command is written inside a Procedure Source.

Procedure Rule:
Parm(&AttractionId);

Procedure Source:
For each Attraction
      where AttractionId=&AttractionId  
           AttractionGeography.FromWkt("POINT(-56.163740158081055 -34.92478600243492)")  
endfor                                 

You can use the same syntax to load and update an attribute based on the GeoPoint data type.

3) &Geography is a variable of Geography data type. &Line is a variable of GeoLine data type. They are being loaded, for example, inside an object Event or an object Source: 

&Geography.FromWkt("LINESTRING(-56.16090774536133 -34.928797162523516, -56.1650276184082 -34.89494244739731)")

or:

&Line.FromWkt("LINESTRING(-56.16090774536133 -34.928797162523516, -56.1650276184082 -34.89494244739731)")

4) &Geography is a variable of Geography data type. &Polygon is a variable of GeoPolygon data type. They are being loaded, for example, inside an object Event or an object Source:

&Geography.FromWkt('POLYGON ((-56.248367 -34.873821, -56.266563 -34.876427, -56.263733 -34.890366, -56.268799 -34.893394, -56.26897 -34.900291, -56.264851 -34.902615, -56.253605 -34.895645, -56.247597 -34.895153, -56.246052 -34.889523, -56.248367 -34.873821, -56.248367 -34.873821))')

or:

&Polygon.FromWkt('POLYGON ((-56.248367 -34.873821, -56.266563 -34.876427, -56.263733 -34.890366, -56.268799 -34.893394, -56.26897 -34.900291, -56.264851 -34.902615, -56.253605 -34.895645, -56.247597 -34.895153, -56.246052 -34.889523, -56.248367 -34.873821, -56.248367 -34.873821))')

See Also

ToWkt method

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