MySQL 8.0.40
Source Code Documentation
gis Namespace Reference

Namespaces

namespace  srs
 

Classes

class  Area
 Area functor that calls boost::geometry::area with the correct parameter types. More...
 
class  Box
 A 2d box with sides parallel to the coordinate system grid. More...
 
class  Buffer
 Buffer functor that calls boost::geometry::buffer with correct geometry type and strategy combination. More...
 
struct  BufferStrategies
 
class  Cartesian_box
 A Cartesian 2d box. More...
 
class  Cartesian_geometrycollection
 A Cartesian 2d geometry collection. More...
 
class  Cartesian_linearring
 A Cartesian 2d linear ring. More...
 
class  Cartesian_linestring
 A Cartesian 2d linestring. More...
 
class  Cartesian_multilinestring
 A Cartesian 2d multilinestring. More...
 
class  Cartesian_multipoint
 A Cartesian 2d multipoint. More...
 
class  Cartesian_multipolygon
 A Cartesian 2d multipolygon. More...
 
class  Cartesian_point
 A Cartesian 2d point. More...
 
class  Cartesian_polygon
 A Cartesian 2d polygon. More...
 
class  Coordinate_range_visitor
 A visitor that checks if coordinates are within range for a spatial reference system. More...
 
class  Covered_by
 Covered_by functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Crosses
 Crosses functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Curve
 An abstract 2d curve. More...
 
class  Difference
 Difference functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Disjoint
 Disjoint functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Distance
 Distance functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Distance_sphere
 Functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Equals
 Equals functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Frechet_distance
 Frechet_distance functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Functor
 The base class of all functors that takes two geometry arguments. More...
 
class  Geographic_box
 A Geographic 2d box. More...
 
class  Geographic_geometrycollection
 A geographic (ellipsoidal) 2d geometry collection. More...
 
class  Geographic_linearring
 A geographic (ellipsoidal) 2d linear ring. More...
 
class  Geographic_linestring
 A geographic (ellipsoidal) 2d linestring. More...
 
class  Geographic_multilinestring
 A geographic (ellipsoidal) 2d multilinestring. More...
 
class  Geographic_multipoint
 A geographic (ellipsoidal) 2d multipoint. More...
 
class  Geographic_multipolygon
 A geographic (ellipsoidal) 2d multipolygon. More...
 
class  Geographic_point
 A geographic (ellipsoidal) 2d point. More...
 
class  Geographic_polygon
 A geographic (ellipsoidal) 2d polygon. More...
 
class  Geometry
 Abstract superclass for all geometric objects. More...
 
class  Geometry_visitor
 Abstract visitor class to be used on class Geometry and descendants. More...
 
class  Geometrycollection
 A collection of geometries. More...
 
class  Hausdorff_distance
 HausdorffDistance functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Intersection
 Intersection functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Intersects
 Intersects functor that calls Boost.Geometry with the correct parameter types. More...
 
struct  invalid_buffer_argument_exception
 Invalid buffer strategies exception. More...
 
struct  invalid_buffer_result_exception
 Invalid buffer result exception. More...
 
class  invalid_geometry_exception
 Invalid geometry exception. More...
 
class  Is_simple
 Is_simple functor calls boost::geometry::is_simple with the correct parameter types. More...
 
class  Is_valid
 
struct  latitude_out_of_range_exception
 Latitude out of range exception. More...
 
class  Length
 Length functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Line_interpolate_point
 Line interpolate functor that calls boost::geometry::line_interpolate with the correct parameter types. More...
 
class  Linearring
 A ring-shaped linestring. More...
 
class  Linestring
 A string of connected line segments. More...
 
struct  longitude_out_of_range_exception
 Longitude out of range exception. More...
 
class  Longitude_range_normalizer
 
class  Multicurve
 An abstract collection of curves. More...
 
class  Multilinestring
 A collection of linestrings. More...
 
class  Multipoint
 A collection of points. More...
 
class  Multipolygon
 A collection of polygons. More...
 
class  Multisurface
 An abstract collection of surfaces. More...
 
class  Nop_visitor
 A visitor that implements the entire interface and does nothing. More...
 
class  not_implemented_exception
 Function/parameter combination not implemented exception. More...
 
class  null_value_exception
 NULL value exception. More...
 
class  Overlaps
 Overlaps functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Point
 A 2d point. More...
 
class  Polygon
 A polygon consisting of an outer ring and zero or more interior rings defining holes in the polygon. More...
 
class  Ring_flip_visitor
 A visitor that flips polygon rings so that exterior rings are in a counter-clockwise direction and interior rings in a clockwise direction. More...
 
class  Simplify
 Simplify functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Surface
 An abstract 2d surface. More...
 
class  SymDifference
 SymDifference functor that calls Boost.Geometry with the correct parameter types. More...
 
class  too_large_polygon_exception
 Too large polygon exception. More...
 
class  Touches
 Touches functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Transform
 Transform functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Unary_functor
 The base class of all functors that take one geometry argument. More...
 
class  Union
 Union functor that calls Boost.Geometry with the correct parameter types. More...
 
struct  Unit
 
class  Within
 Within functor that calls Boost.Geometry with the correct parameter types. More...
 
class  Wkb_parser
 
class  Wkb_size_visitor
 A visitor that computes the size of a WKB representation of a geometry. More...
 
class  Wkb_visitor
 A visitor that serializes the geometry to little-endian WKB and appends it to a string. More...
 

Typedefs

typedef std::uint32_t srid_t
 A spatial reference system ID (SRID). More...
 

Enumerations

enum class  Geometry_type : std::uint32_t {
  kGeometry = 0 , kPoint = 1 , kLinestring = 2 , kPolygon = 3 ,
  kMultipoint = 4 , kMultilinestring = 5 , kMultipolygon = 6 , kGeometrycollection = 7
}
 Types of geometry objects. More...
 
enum class  Coordinate_system { kCartesian = 0 , kGeographic = 1 }
 Types of coordinate systems. More...
 
enum class  Ring_direction { kCW = 0 , kCCW = 1 , kUnknown = 2 }
 Direction of a ring. More...
 
enum class  Unit_Type { kLinear }
 
enum class  Byte_order : std::uint8_t { XDR = 0 , NDR = 1 }
 WKB endianness. More...
 

Functions

bool area (const dd::Spatial_reference_system *srs, const Geometry *g, const char *func_name, double *result, bool *result_null) noexcept
 
bool buffer (const dd::Spatial_reference_system *srs, const Geometry &g, const BufferStrategies &strategies, const char *func_name, std::unique_ptr< Geometry > *result) noexcept
 Creates the buffer of a geometry. More...
 
bool mbr_covered_by (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *covered_by, bool *null) noexcept
 Computes the covered by relation between the minimum bounding rectangles of two geometries. More...
 
template<typename GC >
static bool geometry_collection_apply_crosses (const Crosses &f, const Geometry *g1, const Geometry *g2)
 Apply a Crosses functor to two geometries, which both may be geometry collections, and return the booelan result of the functor applied on each combination of elements in the collections. More...
 
bool crosses (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *crosses, bool *null) noexcept
 Computes the crosses relation between two geometries. More...
 
bool difference (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, std::unique_ptr< Geometry > *result) noexcept
 Finds the difference between two geometries. More...
 
template<typename GC , typename MPt , typename MLs , typename MPy >
static std::unique_ptr< Geometrytyped_geometry_collection_apply_difference (const Difference &f, const Geometrycollection *g1, const Geometry *g2)
 
static std::unique_ptr< Geometrygeometry_collection_apply_difference (const Difference &f, const Geometrycollection *g1, const Geometry *g2)
 Apply a Difference functor to two geometries, where at least one is a geometry collection. More...
 
template<typename GC >
static bool geometry_collection_apply_disjoint (const Disjoint &f, const Geometry *g1, const Geometry *g2)
 Apply a Disjoint functor to two geometries, which both may be geometry collections, and return the boolean result of the functor applied on each combination of elements in the collections. More...
 
bool disjoint (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *disjoint, bool *null) noexcept
 Computes the disjoint relation between two geometries. More...
 
bool mbr_disjoint (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *disjoint, bool *null) noexcept
 Computes the disjoint relation between the minimum bounding rectangles of two geometries. More...
 
bool distance (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, double *distance, bool *is_null) noexcept
 Computes the distance between two geometries. More...
 
template<typename GC >
static double geometry_collection_apply_min (const Functor< double > *f, const Geometry *g1, const Geometry *g2)
 Apply a Functor<double> to two geometries, which both may be geometry collections, and return the minimum result of the functor applied on each combination of elements in the collections. More...
 
static Geographic_point reinterpret_as_degrees (const Cartesian_point &g)
 Map Cartesian geometry to geographic, mapping degrees east = x, degrees north = y. More...
 
static Geographic_multipoint reinterpret_as_degrees (const Cartesian_multipoint &g)
 Map Cartesian geometry to geographic, mapping degrees east = x, degrees north = y. More...
 
bool distance_sphere (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, double sphere_radius, double *result, bool *result_null) noexcept
 Compute the approximate distance between two geometries by assuming the world is a sphere. More...
 
template<typename GC >
static bool geometry_collection_apply_equals (const Equals &f, const Geometry *g1, const Geometry *g2)
 Apply an Equals functor to two geometries, which both may be geometry collections, and return the boolean result of the functor applied on each combination of elements in the collections. More...
 
bool equals (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *equals, bool *null) noexcept
 Computes the equals relation between two geometries. More...
 
bool mbr_equals (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *equals, bool *null) noexcept
 Computes the equals relation between the minimum bounding rectangles of two geometries. More...
 
bool frechet_distance (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, double *frechet_distance, bool *null) noexcept
 Computes the discrete Frechet distance between linestrings. More...
 
template<typename Pt , typename Ls , typename Py , typename GC , typename MPt , typename MLs , typename MPy >
static void typed_split_gc (const GC *gc, MPt *mpt, MLs *mls, MPy *mpy)
 
void split_gc (const Geometrycollection *gc, std::unique_ptr< Multipoint > *mpt, std::unique_ptr< Multilinestring > *mls, std::unique_ptr< Multipolygon > *mpy)
 Splits a geometrycollection into points, linestrings and polygons. More...
 
template<typename MPt , typename MLs , typename MPy >
void typed_gc_union (double semi_major, double semi_minor, std::unique_ptr< Multipoint > *mpt, std::unique_ptr< Multilinestring > *mls, std::unique_ptr< Multipolygon > *mpy)
 
void gc_union (double semi_major, double semi_minor, std::unique_ptr< Multipoint > *mpt, std::unique_ptr< Multilinestring > *mls, std::unique_ptr< Multipolygon > *mpy)
 Cleans up overlapping geometries so that the geometrycollection is broken down into non-overlapping collections. More...
 
std::unique_ptr< gis::Geometrycollectionnarrowest_multigeometry (std::unique_ptr< gis::Geometrycollection > geometrycollection)
 Narrows down a geometrycollection to return a Multipoint, Multilinestring or a Multipolygon if the first level of the geometrycollection contains only points, linestrings or polygons. More...
 
std::unique_ptr< gis::Geometrycollectionnarrowest_multigeometry (std::unique_ptr< Geometrycollection > geometrycollection)
 Narrows down a geometrycollection to return a Multipoint, Multilinestring or a Multipolygon if the first level of the geometrycollection contains only points, linestrings or polygons. More...
 
const char * type_to_name (Geometry_type type)
 Get the type name string corresponding to a geometry type. More...
 
bool operator< (const Point &lhs, const Point &rhs)
 Compares two points. More...
 
bool hausdorff_distance (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, double *hausdorff_distance, bool *null) noexcept
 Computes the discrete hausdorff distance between linestrings. More...
 
bool intersection (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, std::unique_ptr< Geometry > *result) noexcept
 Finds the intersection between two geometries. More...
 
static bool is_collection (const Geometry *g)
 
template<typename MPt , typename MLs >
static auto remove_overlapping_mpt_mls (MPt const &mpt, MLs const &mls, Geometrycollection &result)
 
template<typename MPt , typename MLs , typename MPy >
static auto remove_overlapping_mpt_mls_mpy (MPt const &mpt, MLs const &mls, MPy const &mpy, Geometrycollection &result)
 
template<typename MPt , typename MLs , typename MPy , typename Geometry1 , typename Geometry2 >
static auto apply_bg_intersection (Geometry1 const &g1, Geometry2 const &g2)
 
template<typename MPt , typename MLs , typename MPy , typename Geometry1 , typename Geometry2 , typename Strategy >
static auto apply_bg_intersection (Geometry1 const &g1, Geometry2 const &g2, Strategy const &strategy)
 
template<typename MPt , typename MLs , typename Geometry1 , typename Geometry2 >
static auto apply_bg_brute_force_intersection (Geometry1 const &g1, Geometry2 const &g2)
 
template<typename MPt , typename MLs , typename Geometry1 , typename Geometry2 , typename Strategy >
static auto apply_bg_brute_force_intersection (Geometry1 const &g1, Geometry2 const &g2, Strategy const &strategy)
 
template<typename GC , typename MPt , typename MLs , typename MPy >
static std::unique_ptr< Geometrytyped_geometry_collection_apply_intersection (const Intersection &f, const Geometrycollection *g1, const Geometry *g2)
 
static std::unique_ptr< Geometrygeometry_collection_apply_intersection (const Intersection &f, const Geometrycollection *g1, const Geometry *g2)
 Apply a Intersection functor to two geometries, where at least one is a geometry collection. More...
 
template<typename GC >
static bool geometry_collection_apply_intersects (const Intersects &f, const Geometry *g1, const Geometry *g2)
 Apply an Intersects functor to two geometries, which both may be geometry collections, and return the booelan result of the functor applied on each combination of elements in the collections. More...
 
bool intersects (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *intersects, bool *null) noexcept
 Computes the intersects relation between two geometries. More...
 
bool mbr_intersects (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *intersects, bool *null) noexcept
 Computes the intersects relation between the minimum bounding rectangles of two geometries. More...
 
bool is_simple (const dd::Spatial_reference_system *srs, const Geometry *g, const char *func_name, bool *result, bool *result_null) noexcept
 Test whether geometry is geometrically simple. More...
 
bool is_valid (const dd::Spatial_reference_system *srs, const Geometry *g, const char *func_name, bool *is_valid) noexcept
 Decides if a geometry is valid. More...
 
bool length (const dd::Spatial_reference_system *srs, const Geometry *g1, double *distance, bool *null) noexcept
 Computes the length of linestrings and multilinestrings. More...
 
bool line_interpolate_point (const dd::Spatial_reference_system *srs, const Geometry *g, const double interpolation_distance, const bool return_multiple_points, const char *func_name, std::unique_ptr< Geometry > *result, bool *result_null) noexcept
 Finds the point in a linestring at a given distance from the starting point. More...
 
bool mbrs_are_equal (Box const &mbr1, Box const &mbr2)
 Checks if two MBRs are equal. More...
 
bool mbr_is_empty (Box const &mbr)
 Checks if an MBR is empty. More...
 
bool mbr_is_point (Box const &mbr)
 Checks if an MBR represents a point. More...
 
bool mbr_is_line (Box const &mbr)
 Checks if an MBR represents a line. More...
 
static void merge_mbrs (const std::vector< Cartesian_box > &boxes, Cartesian_box *mbr)
 Merges a vector of Cartesian MBRs into one common MBR. More...
 
static void merge_mbrs (const std::vector< Geographic_box > &boxes, Geographic_box *mbr)
 Merges a vector of geographic MBRs into one common MBR. More...
 
static void cartesian_envelope (const Geometry *g, Cartesian_box *mbr)
 Computes the envelope of a Cartesian geometry. More...
 
static void geographic_envelope (const Geometry *g, double semi_major, double semi_minor, Geographic_box *mbr)
 Computes the envelope of a geographic geometry. More...
 
void box_envelope (const Geometry *g, const dd::Spatial_reference_system *srs, Box *mbr)
 Computes the envelope of a geometry. More...
 
template<typename GC >
static bool geometry_collection_apply_overlaps (const Overlaps &f, const Geometry *g1, const Geometry *g2)
 Apply an Overlaps functor to two geometries, which both may be geometry collections, and return the booelan result of the functor applied on each combination of elements in the collections. More...
 
bool overlaps (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *overlaps, bool *null) noexcept
 Computes the overlaps relation between two geometries. More...
 
bool mbr_overlaps (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *overlaps, bool *null) noexcept
 Computes the overlaps relation between the minimum bounding rectangles of two geometries. More...
 
bool mbr_touches (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *touches, bool *null) noexcept
 Computes the touches relation between the minimum bounding rectangles of two geometries. More...
 
bool mbr_within (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *within, bool *null) noexcept
 Computes the within relation between the minimum bounding rectangles of two geometries. More...
 
bool touches (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *touches, bool *null) noexcept
 Computes the touches relation between two geometries. More...
 
bool within (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *within, bool *null) noexcept
 Computes the within relation between two geometries. More...
 
bool symdifference (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, std::unique_ptr< Geometry > *result) noexcept
 Finds the symdifference between two geometries. More...
 
bool union_ (const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, std::unique_ptr< Geometry > *result, bool *result_null) noexcept
 Finds the union of two geometries. More...
 
bool simplify (const dd::Spatial_reference_system *srs, const Geometry &g, double max_distance, const char *func_name, std::unique_ptr< Geometry > *result) noexcept
 Simplifies a geometry using the Douglas-Peucker algorithm. More...
 
template<typename MPt , typename MLs , typename MPy , typename GC >
static void typed_remove_duplicates (double semi_major, double semi_minor, std::unique_ptr< Geometry > *g)
 
void remove_duplicates (double semi_major, double semi_minor, std::unique_ptr< Geometry > *g)
 Removes all duplicates in a geometrycollection. More...
 
void narrow_geometry (std::unique_ptr< Geometry > *g)
 Narrow a geometry to its simplest form. More...
 
collation_unordered_map< std::string, Unitunits ()
 A function to obtaint the supported units for the gis module. More...
 
bool get_conversion_factor (const std::string &unit, double *conversion_factor)
 Retrieves the length of the unit in meters. More...
 
template<typename PointLike , typename Geometry , typename std::enable_if_t< std::is_same< PointLike, Cartesian_point >::value||std::is_same< PointLike, Cartesian_multipoint >::value > * = nullptr>
bool call_bg_disjoint (const PointLike &g1, const Geometry &g2, const SymDifference &)
 
template<typename MultipointOrLinear , typename Geometry , typename GeometryOut , typename std::enable_if_t< std::is_same< MultipointOrLinear, Cartesian_linestring >::value||std::is_same< MultipointOrLinear, Cartesian_multipoint >::value||std::is_same< MultipointOrLinear, Cartesian_multilinestring >::value > * = nullptr>
void call_bg_difference (const MultipointOrLinear &g1, const Geometry &g2, GeometryOut &gout, const SymDifference &)
 
template<typename Geometry , typename GeometryOut >
void call_bg_difference (const Geographic_multipoint &g1, const Geometry &g2, GeometryOut &gout, const SymDifference &f)
 
template<typename Linear , typename Geometry , typename GeometryOut , typename std::enable_if_t< std::is_same< Linear, Geographic_linestring >::value||std::is_same< Linear, Geographic_multilinestring >::value > * = nullptr>
void call_bg_difference (const Linear &g1, const Geometry &g2, GeometryOut &gout, const SymDifference &f)
 
template<typename MultiPointType , typename Geometry1 , typename Geometry2 >
static auto symdifference_pointlike_pointlike (Geometry1 g1, Geometry2 g2)
 
template<typename GCType , typename Geometry1 , typename Geometry2 >
static auto symdifference_multipoint_linear_or_areal (const SymDifference &f, Geometry1 g1, Geometry2 g2)
 
template<typename GCType , typename Geometry1 , typename Geometry2 >
static auto symdifference_point_linear_or_areal (const SymDifference &f, Geometry1 g1, Geometry2 g2)
 
template<typename MlsType , typename GCType , typename Linear , typename Areal >
static auto symdifference_linear_areal (const SymDifference &f, Linear g1, Areal g2)
 
template<typename MptType , typename MlsType , typename MpyType , typename PtMpt , typename GC >
std::unique_ptr< Geometrysymdifference_pointlike_geomcol (const SymDifference &f, PtMpt g1, GC *g2)
 
template<typename MptType , typename MlsType , typename MpyType , typename Linear , typename GC >
std::unique_ptr< Geometrysymdifference_linear_geomcol (const SymDifference &f, Linear g1, GC *g2)
 
template<typename MptType , typename MlsType , typename Areal , typename GC >
std::unique_ptr< Geometrysymdifference_areal_geomcol (const SymDifference &f, Areal g1, GC *g2)
 
template<typename GC >
static bool geometry_collection_apply_touches (const Touches &f, const Geometry *g1, const Geometry *g2)
 Apply a Touches functor to two geometries, which both may be geometry collections, and return the booelan result of the functor applied on each combination of elements in the collections. More...
 
template<typename CartesianGeometry , typename GeographicGeometry , typename InputGeometry >
auto transform_helper (const InputGeometry &g, const Coordinate_system &m_output_cs, const boost::geometry::srs::transformation<> &m_transformation)
 
template<typename InputGeometryCollection >
auto transform_gc_helper (const InputGeometryCollection &g, const Coordinate_system &m_output_cs, const Transform &transform)
 
bool transform (const dd::Spatial_reference_system *source_srs, const Geometry &in, const dd::Spatial_reference_system *target_srs, const char *func_name, std::unique_ptr< Geometry > *out) noexcept
 Transforms a geometry from one SRS to another. More...
 
template<typename GC , typename MPt , typename MLs , typename MPy >
static std::unique_ptr< Geometrycollectiontyped_geometry_collection_apply_union (const Union &f, const Geometrycollection *g1, const Geometry *g2)
 
static std::unique_ptr< Geometrycollectiongeometry_collection_apply_union (const Union &f, const Geometrycollection *g1, const Geometry *g2)
 Apply a Union functor to two geometries, where at least one is a geometry collection. More...
 
static bool is_valid_type (Geometry_type type)
 Checks if a given type is a valid (and supported) WKB type. More...
 
static bool is_subtype_of (Geometry_type sub, Geometry_type super)
 Checks if a given type is a subtype of a given supertype. More...
 
static bool is_valid_type_or_subtype (Geometry_type sub, Geometry_type super)
 Checks if a given type is a valid type and that it is a subtype of a given supertype. More...
 
std::unique_ptr< Geometryparse_wkb (THD *thd, const dd::Spatial_reference_system *srs, const char *wkb, std::size_t length, bool ignore_axis_order=false)
 Parses a geometry WKB string and constructs a geometry object. More...
 
bool parse_srid (const char *str, std::size_t length, srid_t *srid)
 Parses an SRID from a little-endian string. More...
 
bool parse_geometry (THD *thd, const char *func_name, const String *str, const dd::Spatial_reference_system **srs, std::unique_ptr< Geometry > *geometry, bool treat_unknown_srid_as_cartesian=false)
 Parses a little-endian geometry string (SRID + WKB). More...
 
bool write_geometry (const dd::Spatial_reference_system *srs, Geometry &geometry, String *str)
 Writes a little-endian geometry string (SRID + WKB). More...
 

Variables

constexpr uint kEndRound = 1
 
constexpr uint kEndFlat = 2
 
constexpr uint kJoinRound = 3
 
constexpr uint kJoinMiter = 4
 
constexpr uint kPointCircle = 5
 
constexpr uint kPointSquare = 6
 

Typedef Documentation

◆ srid_t

typedef std::uint32_t gis::srid_t

A spatial reference system ID (SRID).

This type matches the SRID storage format in MySQL.

Enumeration Type Documentation

◆ Byte_order

enum class gis::Byte_order : std::uint8_t
strong

WKB endianness.

Enumerator
XDR 

Big endian.

NDR 

Little endian.

◆ Coordinate_system

enum class gis::Coordinate_system
strong

Types of coordinate systems.

Enumerator
kCartesian 

A Cartesian plane with the same unit in both directions.

kGeographic 

An ellipsoidal system with longitude and latitude coordinates, both in the same unit.

◆ Geometry_type

enum class gis::Geometry_type : std::uint32_t
strong

Types of geometry objects.

Not all are instantiable.

The values and the storage type are the same as used in WKB.

Enumerator
kGeometry 
kPoint 
kLinestring 
kPolygon 
kMultipoint 
kMultilinestring 
kMultipolygon 
kGeometrycollection 

◆ Ring_direction

enum class gis::Ring_direction
strong

Direction of a ring.

Enumerator
kCW 

Clockwise.

kCCW 

Counterclockwise.

kUnknown 

Unknown.

Used only as an output value when the function is unable to determine the ring direction, e.g., if the ring contains only repetitions of the same point, or if there is a spike in the ring.

◆ Unit_Type

enum class gis::Unit_Type
strong
Enumerator
kLinear 

Function Documentation

◆ apply_bg_brute_force_intersection() [1/2]

template<typename MPt , typename MLs , typename Geometry1 , typename Geometry2 >
static auto gis::apply_bg_brute_force_intersection ( Geometry1 const &  g1,
Geometry2 const &  g2 
)
static

◆ apply_bg_brute_force_intersection() [2/2]

template<typename MPt , typename MLs , typename Geometry1 , typename Geometry2 , typename Strategy >
static auto gis::apply_bg_brute_force_intersection ( Geometry1 const &  g1,
Geometry2 const &  g2,
Strategy const &  strategy 
)
static

◆ apply_bg_intersection() [1/2]

template<typename MPt , typename MLs , typename MPy , typename Geometry1 , typename Geometry2 >
static auto gis::apply_bg_intersection ( Geometry1 const &  g1,
Geometry2 const &  g2 
)
static

◆ apply_bg_intersection() [2/2]

template<typename MPt , typename MLs , typename MPy , typename Geometry1 , typename Geometry2 , typename Strategy >
static auto gis::apply_bg_intersection ( Geometry1 const &  g1,
Geometry2 const &  g2,
Strategy const &  strategy 
)
static

◆ area()

bool gis::area ( const dd::Spatial_reference_system srs,
const Geometry g,
const char *  func_name,
double *  result,
bool *  result_null 
)
noexcept

◆ box_envelope()

void gis::box_envelope ( const Geometry g,
const dd::Spatial_reference_system srs,
Box mbr 
)

Computes the envelope of a geometry.

The result may be a collapsed MBR.

Parameters
[in]gThe geometry.
[in]srsThe spatial reference system of the geometry.
[out]mbrThe envelope.

◆ buffer()

bool gis::buffer ( const dd::Spatial_reference_system srs,
const Geometry g,
const BufferStrategies strategies,
const char *  func_name,
std::unique_ptr< Geometry > *  result 
)
noexcept

Creates the buffer of a geometry.

Parameters
[in]srsThe spatial reference system.
[in]gInput geometry.
[in]strategiesStruct holding strategy arguments for buffer creation
[in]func_nameFunction name used in error reporting.
[out]resultThe geometry that is the buffer of input geometry g
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ call_bg_difference() [1/3]

template<typename Geometry , typename GeometryOut >
void gis::call_bg_difference ( const Geographic_multipoint g1,
const Geometry g2,
GeometryOut &  gout,
const SymDifference f 
)

◆ call_bg_difference() [2/3]

template<typename Linear , typename Geometry , typename GeometryOut , typename std::enable_if_t< std::is_same< Linear, Geographic_linestring >::value||std::is_same< Linear, Geographic_multilinestring >::value > * = nullptr>
void gis::call_bg_difference ( const Linear &  g1,
const Geometry g2,
GeometryOut &  gout,
const SymDifference f 
)

◆ call_bg_difference() [3/3]

template<typename MultipointOrLinear , typename Geometry , typename GeometryOut , typename std::enable_if_t< std::is_same< MultipointOrLinear, Cartesian_linestring >::value||std::is_same< MultipointOrLinear, Cartesian_multipoint >::value||std::is_same< MultipointOrLinear, Cartesian_multilinestring >::value > * = nullptr>
void gis::call_bg_difference ( const MultipointOrLinear &  g1,
const Geometry g2,
GeometryOut &  gout,
const SymDifference  
)

◆ call_bg_disjoint()

template<typename PointLike , typename Geometry , typename std::enable_if_t< std::is_same< PointLike, Cartesian_point >::value||std::is_same< PointLike, Cartesian_multipoint >::value > * = nullptr>
bool gis::call_bg_disjoint ( const PointLike &  g1,
const Geometry g2,
const SymDifference f 
)

◆ cartesian_envelope()

static void gis::cartesian_envelope ( const Geometry g,
Cartesian_box mbr 
)
static

Computes the envelope of a Cartesian geometry.

The MBR returned may be a collapsed box.

Parameters
[in]gThe geometry.
[out]mbrThe envelope of g.

◆ crosses()

bool gis::crosses ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  crosses,
bool *  null 
)
noexcept

Computes the crosses relation between two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]crossesWhether g1 crosses g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ difference()

bool gis::difference ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
std::unique_ptr< Geometry > *  result 
)
noexcept

Finds the difference between two geometries.

Parameters
[in]srsThe spatial reference system.
[in]g1Input geometry.
[in]g2Input geometry.
[in]func_nameFunction name used in error reporting.
[out]resultResult.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ disjoint()

bool gis::disjoint ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  disjoint,
bool *  null 
)
noexcept

Computes the disjoint relation between two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]disjointWhether g1 is disjoint from g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ distance()

bool gis::distance ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
double *  distance,
bool *  is_null 
)
noexcept

Computes the distance between two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[out]distanceThe shortest distance between g1 and g2 in the SRS' linear unit.
[out]is_nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ distance_sphere()

bool gis::distance_sphere ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
double  sphere_radius,
double *  result,
bool *  result_null 
)
noexcept

Compute the approximate distance between two geometries by assuming the world is a sphere.

The coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system.
[in]g1Geometry 1.
[in]g2Geometry 2.
[in]func_nameFunction name used in error reporting.
[in]sphere_radiusRadius of sphere.
[out]resultDistance between g1 and g2. Invalid if result_null.
[out]result_nullWhether return value is NULL instead of result.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ equals()

bool gis::equals ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  equals,
bool *  null 
)
noexcept

Computes the equals relation between two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]equalsWhether g1 equals g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ frechet_distance()

bool gis::frechet_distance ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
double *  frechet_distance,
bool *  null 
)
noexcept

Computes the discrete Frechet distance between linestrings.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]frechet_distanceThe Frechet distance between g1 and g2 in the SRS' linear unit.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ gc_union()

void gis::gc_union ( double  semi_major,
double  semi_minor,
std::unique_ptr< Multipoint > *  mpt,
std::unique_ptr< Multilinestring > *  mls,
std::unique_ptr< Multipolygon > *  mpy 
)

Cleans up overlapping geometries so that the geometrycollection is broken down into non-overlapping collections.

All input collections may contain overlapping geometries and duplicates, including the multipolygon. This function requires that at least one of the inputs must be non-empty.

May throw exceptions from BG operations.

Parameters
[in]semi_majorSemi-major axis of ellipsoid.
[in]semi_minorSemi-minor axis of ellipsoid.
[in,out]mptAll points in the geometrycollection.
[in,out]mlsAll linestrings in the geometrycollection.
[in,out]mpyAll polygons in the geometrycollection.

◆ geographic_envelope()

static void gis::geographic_envelope ( const Geometry g,
double  semi_major,
double  semi_minor,
Geographic_box mbr 
)
static

Computes the envelope of a geographic geometry.

The MBR returned may be a collapsed box.

Parameters
[in]gThe geometry.
[in]semi_majorSemi-major axis of ellipsoid.
[in]semi_minorSemi-minor axis of ellipsoid.
[out]mbrThe envelope of g.

◆ geometry_collection_apply_crosses()

template<typename GC >
static bool gis::geometry_collection_apply_crosses ( const Crosses f,
const Geometry g1,
const Geometry g2 
)
static

Apply a Crosses functor to two geometries, which both may be geometry collections, and return the booelan result of the functor applied on each combination of elements in the collections.

Template Parameters
GCCoordinate specific gometry collection type.
Parameters
fFunctor to apply.
g1First geometry.
g2Second geometry.
Return values
trueg1 crosses g2.
falseg1 doesn't cross g2.

◆ geometry_collection_apply_difference()

static std::unique_ptr< Geometry > gis::geometry_collection_apply_difference ( const Difference f,
const Geometrycollection g1,
const Geometry g2 
)
static

Apply a Difference functor to two geometries, where at least one is a geometry collection.

Return the difference of the two geometries.

Parameters
fFunctor to apply.
g1First geometry, of type Geometrycollection.
g2Second geometry.
Return values
uniquepointer to a Geometry.

◆ geometry_collection_apply_disjoint()

template<typename GC >
static bool gis::geometry_collection_apply_disjoint ( const Disjoint f,
const Geometry g1,
const Geometry g2 
)
static

Apply a Disjoint functor to two geometries, which both may be geometry collections, and return the boolean result of the functor applied on each combination of elements in the collections.

Template Parameters
GCCoordinate specific gometry collection type.
Parameters
fFunctor to apply.
g1First geometry.
g2Second geometry.
Return values
trueg1 is disjoint from g2.
falseg1 isn't disjoint from g2.

◆ geometry_collection_apply_equals()

template<typename GC >
static bool gis::geometry_collection_apply_equals ( const Equals f,
const Geometry g1,
const Geometry g2 
)
static

Apply an Equals functor to two geometries, which both may be geometry collections, and return the boolean result of the functor applied on each combination of elements in the collections.

Template Parameters
GCCoordinate specific gometry collection type.
Parameters
fFunctor to apply.
g1First geometry.
g2Second geometry.
Return values
trueg1 equals g2.
falseg1 doesn't equal g2.

◆ geometry_collection_apply_intersection()

static std::unique_ptr< Geometry > gis::geometry_collection_apply_intersection ( const Intersection f,
const Geometrycollection g1,
const Geometry g2 
)
static

Apply a Intersection functor to two geometries, where at least one is a geometry collection.

Return the intersection of the two geometries.

Parameters
fFunctor to apply.
g1First geometry, of type Geometrycollection.
g2Second geometry.
Return values
uniquepointer to a Geometry.

◆ geometry_collection_apply_intersects()

template<typename GC >
static bool gis::geometry_collection_apply_intersects ( const Intersects f,
const Geometry g1,
const Geometry g2 
)
static

Apply an Intersects functor to two geometries, which both may be geometry collections, and return the booelan result of the functor applied on each combination of elements in the collections.

Template Parameters
GCCoordinate specific gometry collection type.
Parameters
fFunctor to apply.
g1First geometry.
g2Second geometry.
Return values
trueg1 intersects g2.
falseg1 doesn't intersect g2.

◆ geometry_collection_apply_min()

template<typename GC >
static double gis::geometry_collection_apply_min ( const Functor< double > *  f,
const Geometry g1,
const Geometry g2 
)
static

Apply a Functor<double> to two geometries, which both may be geometry collections, and return the minimum result of the functor applied on each combination of elements in the collections.

Template Parameters
GCCoordinate specific gometry collection type.
Parameters
fFunctor to apply.
g1First geometry.
g2Second geometry.
Returns
The minimum result of f(g1_i, g2_j), for all g1_i, element of g1, and g2_j, element of g2.

◆ geometry_collection_apply_overlaps()

template<typename GC >
static bool gis::geometry_collection_apply_overlaps ( const Overlaps f,
const Geometry g1,
const Geometry g2 
)
static

Apply an Overlaps functor to two geometries, which both may be geometry collections, and return the booelan result of the functor applied on each combination of elements in the collections.

Template Parameters
GCCoordinate specific gometry collection type.
Parameters
fFunctor to apply.
g1First geometry.
g2Second geometry.
Return values
trueg1 overlaps g2.
falseg1 doesn't overlap g2.

◆ geometry_collection_apply_touches()

template<typename GC >
static bool gis::geometry_collection_apply_touches ( const Touches f,
const Geometry g1,
const Geometry g2 
)
static

Apply a Touches functor to two geometries, which both may be geometry collections, and return the booelan result of the functor applied on each combination of elements in the collections.

Template Parameters
GCCoordinate specific gometry collection type.
Parameters
fFunctor to apply.
g1First geometry.
g2Second geometry.
Return values
trueg1 touches g2.
falseg1 doesn't touch g2.

◆ geometry_collection_apply_union()

static std::unique_ptr< Geometrycollection > gis::geometry_collection_apply_union ( const Union f,
const Geometrycollection g1,
const Geometry g2 
)
static

Apply a Union functor to two geometries, where at least one is a geometry collection.

Return the union of all the geometries of the input geometries.

Parameters
fFunctor to apply.
g1First geometry, of type Geometrycollection.
g2Second geometry.
Return values
uniquepointer to a Geometry.

◆ get_conversion_factor()

bool gis::get_conversion_factor ( const std::string &  unit,
double *  conversion_factor 
)

Retrieves the length of the unit in meters.

Parameters
unitthe name of the unit we want the conversion factor for.
[out]conversion_factorA pointer to where the result should be put, not touched in case of error.
Return values
Trueif unit is not found.
Falsein case of success.

◆ hausdorff_distance()

bool gis::hausdorff_distance ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
double *  hausdorff_distance,
bool *  null 
)
noexcept

Computes the discrete hausdorff distance between linestrings.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]hausdorff_distanceThe Hausdorff distance between g1 and g2 in the SRS' linear unit.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ intersection()

bool gis::intersection ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
std::unique_ptr< Geometry > *  result 
)
noexcept

Finds the intersection between two geometries.

Parameters
[in]srsThe spatial reference system.
[in]g1Input geometry.
[in]g2Input geometry.
[in]func_nameFunction name used in error reporting.
[out]resultResult.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ intersects()

bool gis::intersects ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  intersects,
bool *  null 
)
noexcept

Computes the intersects relation between two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]intersectsWhether g1 intersects g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ is_collection()

static bool gis::is_collection ( const Geometry g)
static

◆ is_simple()

bool gis::is_simple ( const dd::Spatial_reference_system srs,
const Geometry g,
const char *  func_name,
bool *  result,
bool *  result_null 
)
noexcept

Test whether geometry is geometrically simple.

The coordinate system of the geometry must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system.
[in]gGeometry for testing.
[in]func_nameFunction name used in error reporting.
[out]resultWhether g is simple. Invalid if result_null.
[out]result_nullWhether return value is NULL instead of result.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ is_subtype_of()

static bool gis::is_subtype_of ( Geometry_type  sub,
Geometry_type  super 
)
static

Checks if a given type is a subtype of a given supertype.

Parameters
subThe type to check.
superThe supertype.
Return values
trueThe type is the supertype or a subtype of it.
falseThe type is neither the supertype nor a subtype of it.

◆ is_valid()

bool gis::is_valid ( const dd::Spatial_reference_system srs,
const Geometry g,
const char *  func_name,
bool *  is_valid 
)
noexcept

Decides if a geometry is valid.

The SRS must match the SRS referenced by the geometry, this is the caller's responsibility.

Parameters
[in]srsThe spatial reference system.
[in]gThe geometry
[in]func_nameFunction name used in error reporting.
[out]is_validThe validity of the geometry
Return values
falseNo error occurred
trueAn error has occurred, the error has been reported with my_error().

◆ is_valid_type()

static bool gis::is_valid_type ( Geometry_type  type)
static

Checks if a given type is a valid (and supported) WKB type.

Parameters
typeThe type to check
Return values
trueThe type is valid.
falseThe type is invalid.

◆ is_valid_type_or_subtype()

static bool gis::is_valid_type_or_subtype ( Geometry_type  sub,
Geometry_type  super 
)
static

Checks if a given type is a valid type and that it is a subtype of a given supertype.

Parameters
subThe type to check.
superThe supertype.
Return values
trueThe type is a valid subtype of the supertype.
falseThe type is invalid or not a subtype of the supertype.

◆ length()

bool gis::length ( const dd::Spatial_reference_system srs,
const Geometry g1,
double *  distance,
bool *  null 
)
noexcept

Computes the length of linestrings and multilinestrings.

Parameters
[in]srsThe spatial reference system.
[in]g1linestring or multilinestring.
[out]distanceThe length of g1 in the SRS linear unit.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ line_interpolate_point()

bool gis::line_interpolate_point ( const dd::Spatial_reference_system srs,
const Geometry g,
const double  interpolation_distance,
const bool  return_multiple_points,
const char *  func_name,
std::unique_ptr< Geometry > *  result,
bool *  result_null 
)
noexcept

Finds the point in a linestring at a given distance from the starting point.

Parameters
[in]srsThe spatial reference system.
[in]gInput geometry.
[in]interpolation_distanceThe distance from the starting point.
[in]return_multiple_pointsTrue if the return geometry should be a multipoint. False if the return value should be a single point.
[in]func_nameFunction name used in error reporting.
[out]resultResult. Invalid if result_null.
[out]result_nullWhether result is NULL instead of result.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ mbr_covered_by()

bool gis::mbr_covered_by ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  covered_by,
bool *  null 
)
noexcept

Computes the covered by relation between the minimum bounding rectangles of two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]covered_byWhether the MBR of g1 is covered by the MBR of g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ mbr_disjoint()

bool gis::mbr_disjoint ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  disjoint,
bool *  null 
)
noexcept

Computes the disjoint relation between the minimum bounding rectangles of two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]disjointWhether the MBR of g1 is disjoint from the MBR of g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ mbr_equals()

bool gis::mbr_equals ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  equals,
bool *  null 
)
noexcept

Computes the equals relation between the minimum bounding rectangles of two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]equalsWhether the MBR of g1 equals the MBR of g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ mbr_intersects()

bool gis::mbr_intersects ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  intersects,
bool *  null 
)
noexcept

Computes the intersects relation between the minimum bounding rectangles of two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]intersectsWhether the MBR of g1 intersects the MBR of g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ mbr_is_empty()

bool gis::mbr_is_empty ( Box const &  mbr)

Checks if an MBR is empty.

By default, BG box coordinates are NaN. If a geometry is empty, its box will have all NaN coordinates.

Parameters
[in]mbrMBR to check.
Return values
trueThe MBR is empty.
falseThe MBR is not empty.

◆ mbr_is_line()

bool gis::mbr_is_line ( Box const &  mbr)

Checks if an MBR represents a line.

Boxes around vertical and horizontal lines collapse so that either the minimum and maximum X coordinate or Y coordinate are equal.

Parameters
[in]mbrMBR to check.
Return values
trueThe MBR is a line.
falseThe MBR is not a line.

◆ mbr_is_point()

bool gis::mbr_is_point ( Box const &  mbr)

Checks if an MBR represents a point.

Boxes around points collapse so that min_corner == max_corner.

Parameters
[in]mbrMBR to check.
Return values
trueThe MBR is a point.
falseThe MBR is not a point.

◆ mbr_overlaps()

bool gis::mbr_overlaps ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  overlaps,
bool *  null 
)
noexcept

Computes the overlaps relation between the minimum bounding rectangles of two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]overlapsWhether the MBR of g1 overlaps the MBR of g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ mbr_touches()

bool gis::mbr_touches ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  touches,
bool *  null 
)
noexcept

Computes the touches relation between the minimum bounding rectangles of two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]touchesWhether the MBR of g1 touches the MBR of g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ mbr_within()

bool gis::mbr_within ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  within,
bool *  null 
)
noexcept

Computes the within relation between the minimum bounding rectangles of two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]withinWhether the MBR of g1 is within the MBR of g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ mbrs_are_equal()

bool gis::mbrs_are_equal ( Box const &  mbr1,
Box const &  mbr2 
)

Checks if two MBRs are equal.

Empty boxes are considered equal.

Parameters
[in]mbr1First MBR.
[in]mbr2Second MBR.
Return values
trueThe MBRs are equal.
falseThe MBRs are not equal.

◆ merge_mbrs() [1/2]

static void gis::merge_mbrs ( const std::vector< Cartesian_box > &  boxes,
Cartesian_box mbr 
)
static

Merges a vector of Cartesian MBRs into one common MBR.

Since the coordinate system doesn't wrap, the order in which MBRs are expanded doesn't matter.

Parameters
[in]boxesVector of MBRs to merge.
[out]mbrThe resulting MBR.

◆ merge_mbrs() [2/2]

static void gis::merge_mbrs ( const std::vector< Geographic_box > &  boxes,
Geographic_box mbr 
)
static

Merges a vector of geographic MBRs into one common MBR.

The coordinate system wraps, so the MBRs must be expanded in the correct order to avoid creating an MBR that is larger than necessary.

If the vector of boxes is empty, the result MBR is unchanged.

Parameters
[in]boxesVector of MBRs to merge.
[out]mbrThe resulting MBR.

◆ narrow_geometry()

void gis::narrow_geometry ( std::unique_ptr< Geometry > *  g)

Narrow a geometry to its simplest form.

E.g. for a multipoint with only one point, the geometry is reduced to that point. For an input geometry which cannot be narrowed further, the function does nothing.

Parameters
[in,out]gThe geometry to possibly narrow.

◆ narrowest_multigeometry() [1/2]

std::unique_ptr< gis::Geometrycollection > gis::narrowest_multigeometry ( std::unique_ptr< Geometrycollection geometrycollection)

Narrows down a geometrycollection to return a Multipoint, Multilinestring or a Multipolygon if the first level of the geometrycollection contains only points, linestrings or polygons.

Otherwise, if the contents is heterogeneous or contains a geometrycollection, returns the input geometrycollection.

Parameters
[in]geometrycollectionGeometrycollection to be narroweed down.
Returns
The narrowest type that can contain all the geometries in the input.

◆ narrowest_multigeometry() [2/2]

std::unique_ptr< gis::Geometrycollection > gis::narrowest_multigeometry ( std::unique_ptr< Geometrycollection geometrycollection)

Narrows down a geometrycollection to return a Multipoint, Multilinestring or a Multipolygon if the first level of the geometrycollection contains only points, linestrings or polygons.

Otherwise, if the contents is heterogeneous or contains a geometrycollection, returns the input geometrycollection.

Parameters
[in]geometrycollectionGeometrycollection to be narroweed down.
Returns
The narrowest type that can contain all the geometries in the input.

◆ operator<()

bool gis::operator< ( const Point lhs,
const Point rhs 
)
inline

Compares two points.

The point with the lowest X coordinate is the smaller point. If X coordinates are equal, the point with the lowest Y coordinate is the smaller.

Parameters
lhsLeft hand side.
rhsRight hand side.
Return values
trueLeft hand side sorts before right hand side.
falseLeft hand side does not sort before right hand side.

◆ overlaps()

bool gis::overlaps ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  overlaps,
bool *  null 
)
noexcept

Computes the overlaps relation between two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]overlapsWhether g1 overlaps g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ parse_geometry()

bool gis::parse_geometry ( THD thd,
const char *  func_name,
const String str,
const dd::Spatial_reference_system **  srs,
std::unique_ptr< Geometry > *  geometry,
bool  treat_unknown_srid_as_cartesian = false 
)

Parses a little-endian geometry string (SRID + WKB).

The geometry is allocated on the heap and ownership is transferred to the caller.

Parameters
[in]thdThread handle
[in]func_nameThe function name to use in error messages.
[in]strThe geometry string.
[out]srsThe spatial reference system of the geometry.
[out]geometryThe geometry.
[in]treat_unknown_srid_as_cartesianWhether to treat unknown SRIDs as Cartesian. If false, raise an error if the SRID is unknown.
Return values
falseSuccess.
trueError. my_error() has been called.

◆ parse_srid()

bool gis::parse_srid ( const char *  str,
std::size_t  length,
srid_t srid 
)

Parses an SRID from a little-endian string.

Parameters
[in]strThe string.
[in]lengthLength of the string.
[out]sridThe SRID read from the string.
Return values
falseSuccess.
trueError. my_error() has not been called.

◆ parse_wkb()

std::unique_ptr< Geometry > gis::parse_wkb ( THD thd,
const dd::Spatial_reference_system srs,
const char *  wkb,
std::size_t  length,
bool  ignore_axis_order = false 
)

Parses a geometry WKB string and constructs a geometry object.

The geometry is allocated on the heap and ownership is transferred to the caller.

If ignore_axis_order is true, the string is assumed to be on the geometry storage format, not general WKB. The storage format differs from ordinary WKB by having a fixed x=longitude, y=latitude mapping.

Warning
This function checks if there are so many nested levels of geometry collections that the stack will be exhausted. If that happens, my_error is called and the function exits with no geometry value. However, if thd is nullptr, this check is disabled, and the caller is responsible for checking that there is enough stack to parse the WKB string.
Parameters
[in]thdThread handle.
srsThe SRS of the geometry.
wkbThe WKB string.
lengthLength of the WKB string.
ignore_axis_orderIgnore SRS axis order and assume it's always long-lat.
Returns
The geometry. If an error occurred, the return value is a null pointer. In case of stack overrun, my_error has been called.

◆ reinterpret_as_degrees() [1/2]

static Geographic_multipoint gis::reinterpret_as_degrees ( const Cartesian_multipoint g)
static

Map Cartesian geometry to geographic, mapping degrees east = x, degrees north = y.

Do not canonicalize coordinates of poles.

Used when a SQL function needs to accept Cartesian coordinates as a shorthand for geographic with some default SRS.

◆ reinterpret_as_degrees() [2/2]

static Geographic_point gis::reinterpret_as_degrees ( const Cartesian_point g)
static

Map Cartesian geometry to geographic, mapping degrees east = x, degrees north = y.

Do not canonicalize coordinates of poles.

Used when a SQL function needs to accept Cartesian coordinates as a shorthand for geographic with some default SRS.

◆ remove_duplicates()

void gis::remove_duplicates ( double  semi_major,
double  semi_minor,
std::unique_ptr< Geometry > *  g 
)

Removes all duplicates in a geometrycollection.

If the geometry is not a collection, the function does nothing. Duplicates are removed in all levels, so for a geometrycollection, the function is called for each member geometry as well.

Parameters
[in]semi_majorSemi-major axis of ellipsoid.
[in]semi_minorSemi-minor axis of ellipsoid.
[in,out]gThe geometry to remove duplicates from.

◆ remove_overlapping_mpt_mls()

template<typename MPt , typename MLs >
static auto gis::remove_overlapping_mpt_mls ( MPt const &  mpt,
MLs const &  mls,
Geometrycollection result 
)
static

◆ remove_overlapping_mpt_mls_mpy()

template<typename MPt , typename MLs , typename MPy >
static auto gis::remove_overlapping_mpt_mls_mpy ( MPt const &  mpt,
MLs const &  mls,
MPy const &  mpy,
Geometrycollection result 
)
static

◆ simplify()

bool gis::simplify ( const dd::Spatial_reference_system srs,
const Geometry g,
double  max_distance,
const char *  func_name,
std::unique_ptr< Geometry > *  result 
)
noexcept

Simplifies a geometry using the Douglas-Peucker algorithm.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]gThe geometry.
[in]max_distanceCut-off distance (in coordinate units) of the Douglas-Peucker algorithm.
[in]func_nameFunction name used in error reporting.
[out]resultThe simplified geometry.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ split_gc()

void gis::split_gc ( const Geometrycollection gc,
std::unique_ptr< Multipoint > *  mpt,
std::unique_ptr< Multilinestring > *  mls,
std::unique_ptr< Multipolygon > *  mpy 
)

Splits a geometrycollection into points, linestrings and polygons.

All output collections may contain overlapping geometries and duplicates. This is not a problem for the multipoint and multilinestring outputs, but the multipolygon may be geometrically invalid.

Parameters
[in]gcGeometry collection.
[out]mptAll points in the geometrycollection.
[out]mlsAll linestrings in the geometrycollection.
[out]mpyAll polygons in the geometrycollection.

◆ symdifference()

bool gis::symdifference ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
std::unique_ptr< Geometry > *  result 
)
noexcept

Finds the symdifference between two geometries.

Parameters
[in]srsThe spatial reference system.
[in]g1Input geometry.
[in]g2Input geometry.
[in]func_nameFunction name used in error reporting.
[out]resultResult.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ symdifference_areal_geomcol()

template<typename MptType , typename MlsType , typename Areal , typename GC >
std::unique_ptr< Geometry > gis::symdifference_areal_geomcol ( const SymDifference f,
Areal  g1,
GC *  g2 
)

◆ symdifference_linear_areal()

template<typename MlsType , typename GCType , typename Linear , typename Areal >
static auto gis::symdifference_linear_areal ( const SymDifference f,
Linear  g1,
Areal  g2 
)
static

◆ symdifference_linear_geomcol()

template<typename MptType , typename MlsType , typename MpyType , typename Linear , typename GC >
std::unique_ptr< Geometry > gis::symdifference_linear_geomcol ( const SymDifference f,
Linear  g1,
GC *  g2 
)

◆ symdifference_multipoint_linear_or_areal()

template<typename GCType , typename Geometry1 , typename Geometry2 >
static auto gis::symdifference_multipoint_linear_or_areal ( const SymDifference f,
Geometry1  g1,
Geometry2  g2 
)
static

◆ symdifference_point_linear_or_areal()

template<typename GCType , typename Geometry1 , typename Geometry2 >
static auto gis::symdifference_point_linear_or_areal ( const SymDifference f,
Geometry1  g1,
Geometry2  g2 
)
static

◆ symdifference_pointlike_geomcol()

template<typename MptType , typename MlsType , typename MpyType , typename PtMpt , typename GC >
std::unique_ptr< Geometry > gis::symdifference_pointlike_geomcol ( const SymDifference f,
PtMpt  g1,
GC *  g2 
)

◆ symdifference_pointlike_pointlike()

template<typename MultiPointType , typename Geometry1 , typename Geometry2 >
static auto gis::symdifference_pointlike_pointlike ( Geometry1  g1,
Geometry2  g2 
)
static

◆ touches()

bool gis::touches ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  touches,
bool *  null 
)
noexcept

Computes the touches relation between two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]touchesWhether g1 touches g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ transform()

bool gis::transform ( const dd::Spatial_reference_system source_srs,
const Geometry in,
const dd::Spatial_reference_system target_srs,
const char *  func_name,
std::unique_ptr< Geometry > *  out 
)
noexcept

Transforms a geometry from one SRS to another.

Parameters
[in]source_srsThe SRS of the input geometry.
[in]inThe geometry to transform.
[in]target_srsThe SRS of the output geometry.
[in]func_nameFunction name used in error reporting.
[out]outThe output geometry.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ transform_gc_helper()

template<typename InputGeometryCollection >
auto gis::transform_gc_helper ( const InputGeometryCollection &  g,
const Coordinate_system m_output_cs,
const Transform transform 
)

◆ transform_helper()

template<typename CartesianGeometry , typename GeographicGeometry , typename InputGeometry >
auto gis::transform_helper ( const InputGeometry &  g,
const Coordinate_system m_output_cs,
const boost::geometry::srs::transformation<> &  m_transformation 
)

◆ type_to_name()

const char * gis::type_to_name ( Geometry_type  type)

Get the type name string corresponding to a geometry type.

Parameters
typeThe geometry type.
Returns
A string containing the type name (in uppercase).

◆ typed_gc_union()

template<typename MPt , typename MLs , typename MPy >
void gis::typed_gc_union ( double  semi_major,
double  semi_minor,
std::unique_ptr< Multipoint > *  mpt,
std::unique_ptr< Multilinestring > *  mls,
std::unique_ptr< Multipolygon > *  mpy 
)

◆ typed_geometry_collection_apply_difference()

template<typename GC , typename MPt , typename MLs , typename MPy >
static std::unique_ptr< Geometry > gis::typed_geometry_collection_apply_difference ( const Difference f,
const Geometrycollection g1,
const Geometry g2 
)
static

◆ typed_geometry_collection_apply_intersection()

template<typename GC , typename MPt , typename MLs , typename MPy >
static std::unique_ptr< Geometry > gis::typed_geometry_collection_apply_intersection ( const Intersection f,
const Geometrycollection g1,
const Geometry g2 
)
static

◆ typed_geometry_collection_apply_union()

template<typename GC , typename MPt , typename MLs , typename MPy >
static std::unique_ptr< Geometrycollection > gis::typed_geometry_collection_apply_union ( const Union f,
const Geometrycollection g1,
const Geometry g2 
)
static

◆ typed_remove_duplicates()

template<typename MPt , typename MLs , typename MPy , typename GC >
static void gis::typed_remove_duplicates ( double  semi_major,
double  semi_minor,
std::unique_ptr< Geometry > *  g 
)
static

◆ typed_split_gc()

template<typename Pt , typename Ls , typename Py , typename GC , typename MPt , typename MLs , typename MPy >
static void gis::typed_split_gc ( const GC *  gc,
MPt *  mpt,
MLs *  mls,
MPy *  mpy 
)
static

◆ union_()

bool gis::union_ ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
std::unique_ptr< Geometry > *  result,
bool *  result_null 
)
noexcept

Finds the union of two geometries.

Parameters
[in]srsThe spatial reference system.
[in]g1Input geometry.
[in]g2Input geometry.
[in]func_nameFunction name used in error reporting.
[out]resultResult. Invalid if result_null.
[out]result_nullWhether result is NULL instead of result.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ units()

collation_unordered_map< std::string, Unit > gis::units ( )

A function to obtaint the supported units for the gis module.

Returns
Map of supported units for ST_DISTANCE

◆ within()

bool gis::within ( const dd::Spatial_reference_system srs,
const Geometry g1,
const Geometry g2,
const char *  func_name,
bool *  within,
bool *  null 
)
noexcept

Computes the within relation between two geometries.

Both geometries must be in the same coordinate system (Cartesian or geographic), and the coordinate system of the geometries must match the coordinate system of the SRID. It is the caller's responsibility to guarantee this.

Parameters
[in]srsThe spatial reference system, common to both geometries.
[in]g1First geometry.
[in]g2Second geometry.
[in]func_nameFunction name used in error reporting.
[out]withinWhether g1 lies within g2.
[out]nullTrue if the return value is NULL.
Return values
falseSuccess.
trueAn error has occurred. The error has been reported with my_error().

◆ write_geometry()

bool gis::write_geometry ( const dd::Spatial_reference_system srs,
Geometry geometry,
String str 
)

Writes a little-endian geometry string (SRID + WKB).

Parameters
[in]srsThe SRS of the geometry.
[in]geometryThe geometry.
[out]strThe string to write the geometry to.
Return values
falseSuccess.
trueError. my_error() has been called.

Variable Documentation

◆ kEndFlat

constexpr uint gis::kEndFlat = 2
constexpr

◆ kEndRound

constexpr uint gis::kEndRound = 1
constexpr

◆ kJoinMiter

constexpr uint gis::kJoinMiter = 4
constexpr

◆ kJoinRound

constexpr uint gis::kJoinRound = 3
constexpr

◆ kPointCircle

constexpr uint gis::kPointCircle = 5
constexpr

◆ kPointSquare

constexpr uint gis::kPointSquare = 6
constexpr