Jump to: navigation, search

Difference between revisions of "WKTParser"


(Polygon)
 
Line 3: Line 3:
  
 
== Supported Geography types ==
 
== Supported Geography types ==
=== Multiline ===
+
=== Linestring ===
A Multiline is an open line segment defined by 2 or more geo coordinates.
+
A Linestring is an open line segment defined by 2 or more geo coordinates.
  
 
''Example''
 
''Example''
Line 19: Line 19:
 
GeoLine line;
 
GeoLine line;
 
if (parser.TryParseLine(WKT_LINE, out line)
 
if (parser.TryParseLine(WKT_LINE, out line)
 +
{
 +
    ...
 +
}
 +
</source>
 +
 +
=== Multiline ===
 +
A Multiline is an open line segment defined by 2 or more Linestrings.
 +
 +
''Example''
 +
<source lang="csharp">
 +
using UBIK.Kernel.Geography;
 +
 +
string WKT_LINE = "MULTILINESTRING ((" +
 +
            "7.57993575611781 51.683810417826201 0," +
 +
            "7.579931596709839 51.683807447421998 0," +
 +
            "7.5799200326123 51.683760818713999 0," +
 +
            "7.57991875699064 51.683757153992197 0)," +
 +
            ("7.57993575611781 51.683810417826201 0," +
 +
            "7.579931596709839 51.683807447421998 0))" ;
 +
 +
WKTParser parser = new WKTParser();
 +
GeoMultiLine line;
 +
if (parser.TryParseMultiLine(WKT_LINE, out line)
 
{
 
{
 
     ...
 
     ...

Latest revision as of 13:31, 3 April 2020

Overview

The WKT Parser provides the possibility to convert geography objects defined in the format of WKT into UBIK Geography objects.

Supported Geography types

Linestring

A Linestring is an open line segment defined by 2 or more geo coordinates.

Example

using UBIK.Kernel.Geography;

string WKT_LINE = "LINESTRING (" +
            "7.57993575611781 51.683810417826201 0," +
            "7.579931596709839 51.683807447421998 0," +
            "7.5799200326123 51.683760818713999 0," +
            "7.57991875699064 51.683757153992197 0)";

WKTParser parser = new WKTParser();
GeoLine line;
if (parser.TryParseLine(WKT_LINE, out line)
{
    ...
}

Multiline

A Multiline is an open line segment defined by 2 or more Linestrings.

Example

using UBIK.Kernel.Geography;

string WKT_LINE = "MULTILINESTRING ((" +
            "7.57993575611781 51.683810417826201 0," +
            "7.579931596709839 51.683807447421998 0," +
            "7.5799200326123 51.683760818713999 0," +
            "7.57991875699064 51.683757153992197 0)," +
            ("7.57993575611781 51.683810417826201 0," +
            "7.579931596709839 51.683807447421998 0))" ;

WKTParser parser = new WKTParser();
GeoMultiLine line;
if (parser.TryParseMultiLine(WKT_LINE, out line)
{
    ...
}

Polygon

Polygon is a plane figure that is bounded by a finite chain of straight line segments closing in a loop to form a closed chain or circuit.

Example

using UBIK.Kernel.Geography;

string WKT_POLYGON= "POLYGON ("+
            "7.57993575611781 51.683810417826201 0," +
            "7.579931596709839 51.683807447421998 0," +
            "7.5799200326123 51.683760818713999 0," +
            "7.57993575611781 51.683810417826201 0)";

WKTParser parser = new WKTParser();
GeoPolygon polygon;
if (parser.TryParsePolygon(WKT_POLYGON, out polygon)
{
    ...
}