# Geometry

## Geometry module

``````MODULE geom;

COMMAND geom.Area(X_0:wkb):dbl;
COMMENT "Returns the area of the surface if it is a polygon or multi-polygon";

COMMAND geom.AsBinary(X_0:wkb):str;
COMMENT "Returns the wkb representation into HEX format";

function geom.AsEWKT(w:wkb):str;;
COMMENT "";

function geom.AsText(w:wkb):str;;
COMMENT "";

function geom.BdMPolyFromText(wkt:str, srid:int):wkb;;
COMMENT "";

function geom.BdPolyFromText(wkt:str, srid:int):wkb;;
COMMENT "";

COMMAND geom.Boundary(X_0:wkb):wkb;
COMMENT "Returns the closure of the combinatorial boundary of the Geometry.";

COMMAND geom.Buffer(X_0:wkb, X_1:dbl):wkb;
COMMENT "Returns a geometry that represents all points whose distance from this geometry is less than or equal to distance. Calculations are in the Spatial Reference System of this Geometry.";

COMMAND geom.Centroid(X_0:wkb):wkb;
COMMENT "Computes the geometric center of a geometry, or equivalently, the center of mass of the geometry as a POINT.";

COMMAND geom.Contains(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if and only if no points of B lie in the exterior of A, and at least one point of the interior of B lies in the interior of A.";

COMMAND geom.Contains(X_0:wkb, X_1:dbl, X_2:dbl):bit;
COMMENT "Returns true if the Geometry a 'spatially contains' Geometry b";

COMMAND geom.Contains(X_0:wkb, X_1:bat[:dbl], X_2:bat[:dbl]):bat[:bit];
COMMENT "Returns true if the Geometry-BAT a 'spatially contains' Geometry-B b";

COMMAND geom.ConvexHull(X_0:wkb):wkb;
COMMENT "Returns a geometry that represents the convex hull of this geometry. The convex hull of a geometry represents the minimum convex geometry that encloses all geometries within the set.";

COMMAND geom.CoordDim(X_0:wkb):int;
COMMENT "Return the coordinate dimension of the geometry";

COMMAND geom.CoveredBy(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns TRUE if no point of geometry A is outside geometry B";

COMMAND geom.Covers(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns TRUE if no point of geometry B is outside geometry A";

COMMAND geom.Crosses(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns TRUE if the supplied geometries have some, but not all, interior points in common.";

COMMAND geom.DWithin(X_0:wkb, X_1:wkb, X_2:dbl):bit;
COMMENT "Returns true if the two geometries are within the specifies distance from each other";

COMMAND geom.DelaunayTriangles(X_0:wkb, X_1:dbl, X_2:int):wkb;
COMMENT "Returns a Delaunay triangulation, flag=0 => collection of polygons, flag=1 => multilinestring";

COMMAND geom.Difference(X_0:wkb, X_1:wkb):wkb;
COMMENT "Returns a geometry that represents that part of geometry A that does not intersect with geometry B";

COMMAND geom.Dimension(X_0:wkb):int;
COMMENT "The inherent dimension of this Geometry object, which must be less than or equal to the coordinate dimension.";

COMMAND geom.Disjoint(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if these Geometries are 'spatially disjoint'";

COMMAND geom.Distance(X_0:wkb, X_1:wkb):dbl;
COMMENT "Returns the 2-dimensional minimum cartesian distance between the two geometries in projected units (spatial ref units.";

COMMAND geom.Dump(X_0:wkb) (X_1:bat[:str], X_2:bat[:wkb]);
COMMENT "Gets a MultiPolygon and returns the Polygons in it";

COMMAND geom.DumpPoints(X_0:wkb) (X_1:bat[:str], X_2:bat[:wkb]);
COMMENT "Gets a Geometry and returns the Points in it";

COMMAND geom.EndPoint(X_0:wkb):wkb;
COMMENT "Returns the last point of a LINESTRING geometry as a POINT or NULL if the input parameter is not a LINESTRING.";

COMMAND geom.Envelope(X_0:wkb):wkb;
COMMENT "The minimum bounding box for this Geometry, returned as a Geometry. The polygon is defined by the corner points of the bounding box ((MINX,MINY),(MAXX,MINY),(MAXX,MAXY),(MINX,MAXY)).";

COMMAND geom.EnvelopeFromCoordinates(X_0:dbl, X_1:dbl, X_2:dbl, X_3:dbl, X_4:int):wkb;
COMMENT "A polygon created by the provided coordinates";

COMMAND geom.Equals(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the given geometries represent the same geometry. Directionality is ignored.";

COMMAND geom.ExteriorRing(X_0:wkb):wkb;
COMMENT "Returns a line string representing the exterior ring of the POLYGON geometry. Return NULL if the geometry is not a polygon.";

function geom.Force2D(g:wkb):wkb;;
COMMENT "";

function geom.Force3D(g:wkb):wkb;;
COMMENT "";

COMMAND geom.ForceDimensions(X_0:wkb, X_1:int):wkb;
COMMENT "Removes or Adds additional coordinates in the geometry to make it d dimensions";

COMMAND geom.FromBinary(X_0:str):wkb;
COMMENT "Creates a wkb using the HEX representation";

COMMAND geom.FromText(X_0:str, X_1:int, X_2:int):wkb;
COMMENT "";

function geom.GeomCollFromText(wkt:str):wkb;;
COMMENT "";

function geom.GeomCollFromText(wkt:str, srid:int):wkb;;
COMMENT "";

function geom.GeomFromText(wkt:str):wkb;;
COMMENT "";

function geom.GeomFromText(wkt:str, srid:int):wkb;;
COMMENT "";

COMMAND geom.GeometryN(X_0:wkb, X_1:int):wkb;
COMMENT "Returns the 1-based Nth geometry if the geometry is a GEOMETRYCOLLECTION, (MULTI)POINT, (MULTI)LINESTRING, MULTICURVE or (MULTI)POLYGON. Otherwise, return NULL";

COMMAND geom.GeometryType(X_0:wkb, X_1:int):str;
COMMENT "";

function geom.GeometryType1(w:wkb):str;;
COMMENT "";

function geom.GeometryType2(w:wkb):str;;
COMMENT "";

COMMAND geom.GetCoordinate(X_0:wkb, X_1:int):dbl;
COMMENT "Returns the coordinate at position idx of a point, or NULL if not available. idx=0 -> X, idx=1 -> Y, idx=2 -> Z. Input must be point";

COMMAND geom.InteriorRingN(X_0:wkb, X_1:int):wkb;
COMMENT "Return the Nth interior linestring ring of the polygon geometry. Return NULL if the geometry is not a polygon or the given N is out of range.";

COMMAND geom.InteriorRings(X_0:wkb):wkba;
COMMENT "Returns an 'array' with all the interior rings of the polygon";

COMMAND geom.Intersection(X_0:wkb, X_1:wkb):wkb;
COMMENT "Returns a geometry that represents the point set intersection of the Geometries a, b";

COMMAND geom.Intersects(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if these Geometries 'spatially intersect in 2D'";

COMMAND geom.IsClosed(X_0:wkb):bit;
COMMENT "Returns TRUE if the LINESTRING's start and end points are coincident.";

COMMAND geom.IsEmpty(X_0:wkb):bit;
COMMENT "Returns true if this Geometry is an empty geometry.";

COMMAND geom.IsRing(X_0:wkb):bit;
COMMENT "Returns TRUE if this LINESTRING is both closed and simple.";

COMMAND geom.IsSimple(X_0:wkb):bit;
COMMENT "Returns (TRUE) if this Geometry has no anomalous geometric points, such as self intersection or self tangency.";

COMMAND geom.IsValid(X_0:wkb):bit;
COMMENT "Returns true if the ST_Geometry is well formed.";

COMMAND geom.IsValidDetail(X_0:wkb):str;
COMMENT "Returns a valid_detail (valid,reason,location) row stating if a geometry is valid or not and if not valid, a reason why and a location where.";

COMMAND geom.IsValidReason(X_0:wkb):str;
COMMENT "Returns text stating if a geometry is valid or not and if not valid, a reason why.";

COMMAND geom.Length(X_0:wkb):dbl;
COMMENT "Returns the cartesian 2D length of the geometry if it is a linestring or multilinestring";

function geom.LineFromText(wkt:str):wkb;;
COMMENT "";

function geom.LineFromText(wkt:str, srid:int):wkb;;
COMMENT "";

function geom.MLineFromText(wkt:str):wkb;;
COMMENT "";

function geom.MLineFromText(wkt:str, srid:int):wkb;;
COMMENT "";

COMMAND geom.MLineStringToPolygon(X_0:str, X_1:int, X_2:int):wkb;
COMMENT "Creates polygons using the MultiLineString provided as WKT. Depending on the flag creates one (flag=0) or multiple (flag=1) polygons";

function geom.MPointFromText(wkt:str):wkb;;
COMMENT "";

function geom.MPointFromText(wkt:str, srid:int):wkb;;
COMMENT "";

function geom.MPolyFromText(wkt:str):wkb;;
COMMENT "";

function geom.MPolyFromText(wkt:str, srid:int):wkb;;
COMMENT "";

COMMAND geom.MakeBox2D(X_0:wkb, X_1:wkb):mbr;
COMMENT "Creates an mbr from the two 2D points";

function geom.MakeEnvelope(xmin:dbl, ymin:dbl, xmax:dbl, ymax:dbl):wkb;;
COMMENT "";

function geom.MakeEnvelope(xmin:dbl, ymin:dbl, xmax:dbl, ymax:dbl, srid:int):wkb;;
COMMENT "";

COMMAND geom.MakeLine(X_0:wkb, X_1:wkb):wkb;
COMMENT "Gets two point or linestring geometries and returns a linestring geometry";

COMMAND geom.MakeLine(X_0:bat[:wkb]):wkb;
COMMENT "Gets a BAT with point or linestring geometries and returns a single linestring geometry";

function geom.MakePoint(x:dbl, y:dbl):wkb;;
COMMENT "";

function geom.MakePoint(x:dbl, y:dbl, z:dbl):wkb;;
COMMENT "";

function geom.MakePoint(x:dbl, y:dbl, z:dbl, m:dbl):wkb;;
COMMENT "";

function geom.MakePointM(x:dbl, y:dbl, m:dbl):wkb;;
COMMENT "";

COMMAND geom.MakePointXYZM(X_0:dbl, X_1:dbl, X_2:dbl, X_3:dbl, X_4:int):wkb;
COMMENT "creates a point using the coordinates";

function geom.MakePolygon(external:wkb):wkb;;
COMMENT "";

function geom.MakePolygon(external:wkb, srid:int):wkb;;
COMMENT "";

function geom.NPoints(w:wkb):int;;
COMMENT "";

function geom.NRings(w:wkb):int;;
COMMENT "";

COMMAND geom.NumGeometries(X_0:wkb):int;
COMMENT "Returns the number of geometries";

function geom.NumInteriorRings(w:wkb):int;;
COMMENT "";

function geom.NumPoints(w:wkb):int;;
COMMENT "";

COMMAND geom.NumRings(X_0:wkb, X_1:int):int;
COMMENT "Returns the number of interior rings+exterior on the first polygon of the geometry";

COMMAND geom.Overlaps(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns TRUE if the Geometries intersect but are not completely contained by each other.";

function geom.PointFromText(wkt:str):wkb;;
COMMENT "";

function geom.PointFromText(wkt:str, srid:int):wkb;;
COMMENT "";

COMMAND geom.PointN(X_0:wkb, X_1:int):wkb;
COMMENT "Returns the n-th point of the Geometry. Argument w should be Linestring.";

COMMAND geom.PointOnSurface(X_0:wkb):wkb;
COMMENT "Returns a point guaranteed to lie on the surface. Similar to postGIS it works for points and lines in addition to surfaces and for 3d geometries.";

COMMAND geom.PointsNum(X_0:wkb, X_1:int):int;
COMMENT "The number of points in the Geometry. If check=1, the geometry should be a linestring";

COMMAND geom.Polygon(X_0:wkb, X_1:bat[:wkb], X_2:int):wkb;
COMMENT "Returns a Polygon created from the provided LineStrings";

function geom.PolygonFromText(wkt:str):wkb;;
COMMENT "";

function geom.PolygonFromText(wkt:str, srid:int):wkb;;
COMMENT "";

COMMAND geom.Relate(X_0:wkb, X_1:wkb, X_2:str):bit;
COMMENT "Returns true if the Geometry a 'spatially related' to Geometry b, by testing for intersection between the Interior, Boundary and Exterior of the two geometries as specified by the values in the intersectionPatternMatrix.";

COMMAND geom.Segmentize(X_0:wkb, X_1:dbl):wkb;
COMMENT "It creates a new geometry with all segments on it smaller or equal to sz";

COMMAND geom.StartPoint(X_0:wkb):wkb;
COMMENT "Returns the first point of a LINESTRING geometry as a POINT or NULL if the input parameter is not a LINESTRING";

COMMAND geom.SymDifference(X_0:wkb, X_1:wkb):wkb;
COMMENT "Returns a geometry that represents the portions of A and B that do not intersect";

COMMAND geom.ToText(X_0:wkb, X_1:int):str;
COMMENT "";

COMMAND geom.Touches(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns TRUE if the geometries have at least one point in common, but their interiors do not intersect.";

COMMAND geom.Transform(X_0:wkb, X_1:int, X_2:int, X_3:str, X_4:str):wkb;
COMMENT "Transforms a geometry from one srid to another";

function geom.Translate(g:wkb, dx:dbl, dy:dbl):wkb;;
COMMENT "";

function geom.Translate(g:wkb, dx:dbl, dy:dbl, dz:dbl):wkb;;
COMMENT "";

COMMAND geom.Translate3D(X_0:wkb, X_1:dbl, X_2:dbl, X_3:dbl):wkb;
COMMENT "Moves all points of the geometry by dx, dy, dz";

COMMAND geom.Union(X_0:wkb, X_1:wkb):wkb;
COMMENT "Returns a geometry that represents the point set union of the Geometries a, b";

COMMAND geom.Union(X_0:bat[:wkb]):wkb;
COMMENT "Gets a BAT with geometries and returns their union";

COMMAND geom.Within(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns TRUE if the geometry A is completely inside geometry B";

function geom.X(w:wkb):dbl;;
COMMENT "";

function geom.XMaxFromMBR(b:mbr):dbl;;
COMMENT "";

function geom.XMaxFromWKB(g:wkb):dbl;;
COMMENT "";

function geom.XMinFromMBR(b:mbr):dbl;;
COMMENT "";

function geom.XMinFromWKB(g:wkb):dbl;;
COMMENT "";

function geom.Y(w:wkb):dbl;;
COMMENT "";

function geom.YMaxFromMBR(b:mbr):dbl;;
COMMENT "";

function geom.YMaxFromWKB(g:wkb):dbl;;
COMMENT "";

function geom.YMinFromMBR(b:mbr):dbl;;
COMMENT "";

function geom.YMinFromWKB(g:wkb):dbl;;
COMMENT "";

function geom.Z(w:wkb):dbl;;
COMMENT "";

COMMAND geom.coordinateFromMBR(X_0:mbr, X_1:int):dbl;
COMMENT "returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided mbr";

COMMAND geom.coordinateFromWKB(X_0:wkb, X_1:int):dbl;
COMMENT "returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided geometry";

COMMAND geom.epilogue():void;
COMMENT "";

COMMAND geom.getSRID(X_0:wkb):int;
COMMENT "Returns the Spatial Reference System ID for this Geometry.";

COMMAND geom.getType(X_0:int, X_1:int):str;
COMMENT "returns the str representation of the geometry type";

COMMAND geom.hasM(X_0:int):int;
COMMENT "returns 1 if the geometry has m coordinate";

COMMAND geom.hasZ(X_0:int):int;
COMMENT "returns 1 if the geometry has z coordinate";

COMMAND geom.mbr(X_0:wkb):mbr;
COMMENT "Creates the mbr for the given wkb.";

COMMAND geom.mbrAbove(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 is above box2";

COMMAND geom.mbrAbove(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 is above the mbr of geom2";

COMMAND geom.mbrBelow(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 is below box2";

COMMAND geom.mbrBelow(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 is below the mbr of geom2";

COMMAND geom.mbrContained(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 is contained by box2";

COMMAND geom.mbrContained(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 is contained by the mbr of geom2";

COMMAND geom.mbrContains(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 contains box2";

COMMAND geom.mbrContains(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 contains the mbr of geom2";

COMMAND geom.mbrDistance(X_0:mbr, X_1:mbr):dbl;
COMMENT "Returns the distance of the centroids of the two boxes";

COMMAND geom.mbrDistance(X_0:wkb, X_1:wkb):dbl;
COMMENT "Returns the distance of the centroids of the mbrs of the two geometries";

COMMAND geom.mbrEqual(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 is the same as box2";

COMMAND geom.mbrEqual(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 is the same as the mbr of geom2";

COMMAND geom.mbrLeft(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 is left of box2";

COMMAND geom.mbrLeft(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 is left of the mbr of geom2";

COMMAND geom.mbrOverlapOrAbove(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 overlaps or is above box2";

COMMAND geom.mbrOverlapOrAbove(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 overlaps or is above the mbr of geom2";

COMMAND geom.mbrOverlapOrBelow(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 overlaps or is below box2";

COMMAND geom.mbrOverlapOrBelow(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 overlaps or is below the mbr of geom2";

COMMAND geom.mbrOverlapOrLeft(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 overlaps or is to the left of box2";

COMMAND geom.mbrOverlapOrLeft(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 overlaps or is to the left of thr mbr of geom2";

COMMAND geom.mbrOverlapOrRight(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 overlalps or is right of box2";

COMMAND geom.mbrOverlapOrRight(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 overlalps or is right of the mbr of geom2";

COMMAND geom.mbrOverlaps(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 overlaps box2";

COMMAND geom.mbrOverlaps(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 overlaps the mbr of geom2";

COMMAND geom.mbrRight(X_0:mbr, X_1:mbr):bit;
COMMENT "Returns true if box1 is right of box2";

COMMAND geom.mbrRight(X_0:wkb, X_1:wkb):bit;
COMMENT "Returns true if the mbr of geom1 is right of the mbr of geom2";

COMMAND geom.setSRID(X_0:wkb, X_1:int):wkb;
COMMENT "Sets the Reference System ID for this Geometry.";
``````

## Batgeom module

``````MODULE batgeom;

function batgeom.AsEWKT(w:bat[:wkb]):bat[:str];;
COMMENT "";

function batgeom.AsText(w:bat[:wkb]):bat[:str];;
COMMENT "";

COMMAND batgeom.Boundary(X_0:bat[:wkb]):bat[:wkb];
COMMENT "";

COMMAND batgeom.Contains(X_0:bat[:wkb], X_1:bat[:wkb]):bat[:bit];
COMMENT "";

COMMAND batgeom.Contains(X_0:bat[:wkb], X_1:wkb):bat[:bit];
COMMENT "";

COMMAND batgeom.Contains(X_0:wkb, X_1:bat[:wkb]):bat[:bit];
COMMENT "";

COMMAND batgeom.Dimension(X_0:bat[:wkb]):bat[:int];
COMMENT "";

COMMAND batgeom.Distance(X_0:bat[:wkb], X_1:bat[:wkb]):bat[:dbl];
COMMENT "";

COMMAND batgeom.Distance(X_0:bat[:wkb], X_1:wkb):bat[:dbl];
COMMENT "";

COMMAND batgeom.Distance(X_0:wkb, X_1:bat[:wkb]):bat[:dbl];
COMMENT "";

COMMAND batgeom.Filter(X_0:bat[:wkb], X_1:wkb):bat[:wkb];
COMMENT "";

COMMAND batgeom.Filter(X_0:wkb, X_1:bat[:wkb]):bat[:wkb];
COMMENT "Filters the points in the bats according to the MBR of the other bat.";

COMMAND batgeom.FromText(X_0:bat[:str], X_1:int, X_2:int):bat[:wkb];
COMMENT "";

function batgeom.GeomCollFromText(wkt:bat[:str]):bat[:wkb];;
COMMENT "";

function batgeom.GeomCollFromText(wkt:bat[:str], srid:int):bat[:wkb];;
COMMENT "";

function batgeom.GeomFromText(wkt:bat[:str]):bat[:wkb];;
COMMENT "";

function batgeom.GeomFromText(wkt:bat[:str], srid:int):bat[:wkb];;
COMMENT "";

COMMAND batgeom.GeometryN(X_0:bat[:wkb], X_1:int):bat[:wkb];
COMMENT "Returns the 1-based Nth geometry if the geometry is a GEOMETRYCOLLECTION, (MULTI)POINT, (MULTI)LINESTRING, MULTICURVE or (MULTI)POLYGON. Otherwise, return NULL";

COMMAND batgeom.GeometryType(X_0:bat[:wkb], X_1:int):bat[:str];
COMMENT "";

function batgeom.GeometryType1(w:bat[:wkb]):bat[:str];;
COMMENT "";

function batgeom.GeometryType2(w:bat[:wkb]):bat[:str];;
COMMENT "";

COMMAND batgeom.GetCoordinate(X_0:bat[:wkb], X_1:int):bat[:dbl];
COMMENT "Returns the coordinate at position idx of a point, or NULL if not available. idx=0 -> X, idx=1 -> Y, idx=2 -> Z. Input must be point";

COMMAND batgeom.IsClosed(X_0:bat[:wkb]):bat[:bit];
COMMENT "";

COMMAND batgeom.IsEmpty(X_0:bat[:wkb]):bat[:bit];
COMMENT "";

COMMAND batgeom.IsRing(X_0:bat[:wkb]):bat[:bit];
COMMENT "";

COMMAND batgeom.IsSimple(X_0:bat[:wkb]):bat[:bit];
COMMENT "";

COMMAND batgeom.IsValid(X_0:bat[:wkb]):bat[:bit];
COMMENT "";

function batgeom.LineFromText(wkt:bat[:str]):bat[:wkb];;
COMMENT "";

function batgeom.LineFromText(wkt:bat[:str], srid:int):bat[:wkb];;
COMMENT "";

function batgeom.MLineFromText(wkt:bat[:str]):bat[:wkb];;
COMMENT "";

function batgeom.MLineFromText(wkt:bat[:str], srid:int):bat[:wkb];;
COMMENT "";

function batgeom.MPointFromText(wkt:bat[:str]):bat[:wkb];;
COMMENT "";

function batgeom.MPointFromText(wkt:bat[:str], srid:int):bat[:wkb];;
COMMENT "";

function batgeom.MPolyFromText(wkt:bat[:str]):bat[:wkb];;
COMMENT "";

function batgeom.MPolyFromText(wkt:bat[:str], srid:int):bat[:wkb];;
COMMENT "";

COMMAND batgeom.MakeBox2D(X_0:bat[:wkb], X_1:bat[:wkb]):bat[:mbr];
COMMENT "";

COMMAND batgeom.MakeLine(X_0:bat[:wkb], X_1:bat[:wkb]):bat[:wkb];
COMMENT "Gets two BATS of point or linestring geometries and returns a bat with linestring geometries";

function batgeom.MakePoint(x:bat[:dbl], y:bat[:dbl]):bat[:wkb];;
COMMENT "";

function batgeom.MakePoint(x:bat[:dbl], y:bat[:dbl], z:bat[:dbl]):bat[:wkb];;
COMMENT "";

function batgeom.MakePoint(x:bat[:dbl], y:bat[:dbl], z:bat[:dbl], m:bat[:dbl]):bat[:wkb];;
COMMENT "";

function batgeom.MakePointM(x:bat[:dbl], y:bat[:dbl], m:bat[:dbl]):bat[:wkb];;
COMMENT "";

COMMAND batgeom.MakePointXYZM(X_0:bat[:dbl], X_1:bat[:dbl], X_2:bat[:dbl], X_3:bat[:dbl], X_4:int):bat[:wkb];
COMMENT "creates a point using the coordinates";

function batgeom.NPoints(w:bat[:wkb]):bat[:int];;
COMMENT "";

function batgeom.NRings(w:bat[:wkb]):bat[:int];;
COMMENT "";

COMMAND batgeom.NumGeometries(X_0:bat[:wkb]):bat[:int];
COMMENT "Returns the number of geometries";

function batgeom.NumInteriorRings(w:bat[:wkb]):bat[:int];;
COMMENT "";

function batgeom.NumPoints(w:bat[:wkb]):bat[:int];;
COMMENT "";

COMMAND batgeom.NumRings(X_0:bat[:wkb], X_1:int):bat[:int];
COMMENT "Returns the number of interior rings+exterior on the first polygon of the geometry";

function batgeom.PointFromText(wkt:bat[:str]):bat[:wkb];;
COMMENT "";

function batgeom.PointFromText(wkt:bat[:str], srid:int):bat[:wkb];;
COMMENT "";

COMMAND batgeom.PointsNum(X_0:bat[:wkb], X_1:int):bat[:int];
COMMENT "The number of points in the Geometry. If check=1, the geometry should be a linestring";

function batgeom.PolygonFromText(wkt:bat[:str]):bat[:wkb];;
COMMENT "";

function batgeom.PolygonFromText(wkt:bat[:str], srid:int):bat[:wkb];;
COMMENT "";

COMMAND batgeom.ToText(X_0:bat[:wkb], X_1:int):bat[:str];
COMMENT "";

COMMAND batgeom.Union(X_0:bat[:wkb], X_1:bat[:wkb]):bat[:wkb];
COMMENT "Gets two BATS of geometries and returns the pairwise unions";

function batgeom.X(w:bat[:wkb]):bat[:dbl];;
COMMENT "";

function batgeom.XMaxFromMBR(b:bat[:mbr]):bat[:dbl];;
COMMENT "";

function batgeom.XMaxFromWKB(g:bat[:wkb]):bat[:dbl];;
COMMENT "";

function batgeom.XMinFromMBR(b:bat[:mbr]):bat[:dbl];;
COMMENT "";

function batgeom.XMinFromWKB(g:bat[:wkb]):bat[:dbl];;
COMMENT "";

function batgeom.Y(w:bat[:wkb]):bat[:dbl];;
COMMENT "";

function batgeom.YMaxFromMBR(b:bat[:mbr]):bat[:dbl];;
COMMENT "";

function batgeom.YMaxFromWKB(g:bat[:wkb]):bat[:dbl];;
COMMENT "";

function batgeom.YMinFromMBR(b:bat[:mbr]):bat[:dbl];;
COMMENT "";

function batgeom.YMinFromWKB(g:bat[:wkb]):bat[:dbl];;
COMMENT "";

function batgeom.Z(w:bat[:wkb]):bat[:dbl];;
COMMENT "";

COMMAND batgeom.coordinateFromMBR(X_0:bat[:mbr], X_1:int):bat[:dbl];
COMMENT "returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided mbr";

COMMAND batgeom.coordinateFromWKB(X_0:bat[:wkb], X_1:int):bat[:dbl];
COMMENT "returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided geometry";

COMMAND batgeom.mbr(X_0:bat[:wkb]):bat[:mbr];
COMMENT "Creates the mbr for the given wkb.";

COMMAND batgeom.setSRID(X_0:bat[:wkb], X_1:int):bat[:wkb];
COMMENT "Sets the Reference System ID for this Geometry.";
``````