Measurements

SQL/MM Lua
ST.Area() Geometry.area()
ST.Length() Geometry.length()
ST.Distance() Geometry.distance()
ST.HausdorffDistance() Geometry.hausdorffdistance() Geometry.hausdorff()
Geometry.area()
Returns:the area of the surface
Return type:double

Returns the area of the surface if it is a Polygon or MultiPolygon.

This method implements OpenGIS® Simple Feature Access specification. OGC 06-103r4 6.1.10.2.

tarantool> nevada = gis.Polygon({{
    {-120.000000, 42.000000};
    {-114.000000, 42.000000};
    {-114.000000, 34.687427};
    {-120.000000, 39.000000};
    {-120.000000, 42.000000};
}}, 4326)
---
...

-- Use U.S. National Atlas Equal Area projection (meters)
tarantool> nevada:transform(2163):area() * 1e-6
---
- 293496.74070953 -- km^2
...
ST.Area(g)

This function is a SQL/MM-compatible alias for Geometry.area(). SQL-MM 3: 8.1.2, 9.5.3.

Geometry.length()
Returns:2D length of the curve
Return type:number

Returns the 2D Cartesian length of the geometry.

This method implements OpenGIS® Simple Feature Access specification. OGC 06-103r4 6.1.6.2.

tarantool> lasvegas = gis.Point({-115.136389, 36.175}, 4326):transform(2770)
---
...

tarantool> losangeles = gis.Point({-118.25, 34.05}, 4326):transform(2770)
---
...

tarantool> gis.LineString({lasvegas, losangeles}, 2770):length()
---
- 368942.77529796
...
ST.Length(g1, g2)

This function is a SQL/MM-compatible alias for Geometry.length(). SQL-MM 3: 7.1.2, 9.3.4.

Geometry.distance(g2)
Parameters:g2 (geometry) – geometry
Returns:cartesian distance between two geometries in units of spatial reference system
Return type:number

Returns the minimum cartesian distance between two geometries in units of spatial reference system.

This method implements OpenGIS® Simple Feature Access specification. OGC 06-103r4 6.1.2.4.

tarantool> lasvegas = gis.Point({-115.136389, 36.175}, 4326):transform(2770)
---
...

tarantool> losangeles = gis.Point({-118.25, 34.05}, 4326):transform(2770)
---
...

tarantool> lasvegas:distance(losangeles)
---
- 368942.77529796
...
ST.Distance(g1, g2)

This function is a SQL/MM-compatible alias for Geometry.distance(). SQL-MM 3: 5.1.23.

Geometry.hausdorff(g2)
Geometry.hausdorffdistance(g2)
Geometry.hausdorff(g2, densityfrac)
Geometry.hausdorffdistance(g2, densityfrac)
Parameters:
  • g2 (geometry) – geometry
  • densityfrac (double) – fraction of segment densification
Returns:

Hausdorff distance between two geometries

Return type:

number

Returns the Hausdorff distance between two geometries. Basically a measure of how similar or dissimilar 2 geometries are.

When densifyFrac is specified, this function performs a segment densification before computing the discrete hausdorff distance. The densifyFrac parameter sets the fraction by which to densify each segment. Each segment will be split into a number of equal-length subsegments, whose fraction of the total length is closest to the given fraction.

tarantool> linestring = gis.LineString({ {0, 0}, {2, 0} }, 0)
---
...

tarantool> multipoint = gis.MultiPoint({ {0, 1}, {1, 0}, {2, 1} }, 0)
---
...

tarantool> linestring:hausdorff(multipoint)
---
- 1
...

tarantool> linestring2 = gis.LineString({ {0, 0}, {3, 0}, {0, 3} }, 0)
---
...

tarantool> linestring:hausdorff(linestring2)
---
- 3
...
ST.HausdorffDistance(g1, g2)

An alias for Geometry.hausdorff()