Rechercher dans le manuel MySQL
12.16.8 Spatial Operator Functions
OpenGIS proposes a number of functions that can produce geometries. They are designed to implement spatial operators.
These functions support all argument type combinations except those that are inapplicable according to the Open Geospatial Consortium specification.
Unless otherwise specified, functions in this section handle their arguments as follows:
If any argument is
NULL
, the return value isNULL
.If any geometry argument is not a syntactically well-formed geometry, an
ER_GIS_INVALID_DATA
error occurs.If any geometry argument has an SRID value that refers to an undefined spatial reference system (SRS), an
ER_SRS_NOT_FOUND
error occurs.For functions that take multiple geometry arguments, if those arguments do not have the same SRID, an
ER_GIS_DIFFERENT_SRIDS
error occurs.If any geometry argument has an SRID value for a geographic SRS, an
ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS
error occurs.Otherwise, the return value is non-
NULL
.
These spatial operator functions are available:
ST_Buffer(
g
,d
[,strategy1
[,strategy2
[,strategy3
]]])Returns a geometry that represents all points whose distance from the geometry value
g
is less than or equal to a distance ofd
.If the geometry argument is empty,
ST_Buffer()
returns an empty geometry.If the distance is 0,
ST_Buffer()
returns the geometry argument unchanged:- +------------------------------+
- | ST_AsText(ST_Buffer(@pt, 0)) |
- +------------------------------+
- +------------------------------+
ST_Buffer()
supports negative distances forPolygon
andMultiPolygon
values, and for geometry collections containingPolygon
orMultiPolygon
values. The result may be an empty geometry.ST_Buffer()
permits up to three optional strategy arguments following the distance argument. Strategies influence buffer computation. These arguments are byte string values produced by theST_Buffer_Strategy()
function, to be used for point, join, and end strategies:Point strategies apply to
Point
andMultiPoint
geometries. If no point strategy is specified, the default isST_Buffer_Strategy('point_circle', 32)
.Join strategies apply to
LineString
,MultiLineString
,Polygon
, andMultiPolygon
geometries. If no join strategy is specified, the default isST_Buffer_Strategy('join_round', 32)
.End strategies apply to
LineString
andMultiLineString
geometries. If no end strategy is specified, the default isST_Buffer_Strategy('end_round', 32)
.
Up to one strategy of each type may be specified, and they may be given in any order.
ST_Buffer()
handles its arguments as described in the introduction to this section, with these exceptions:For a negative distance for
Point
,MultiPoint
,LineString
, andMultiLineString
values, and for geometry collections not containing anyPolygon
orMultiPolygon
values, anER_WRONG_ARGUMENTS
error occurs.If multiple strategies of a given type are specified, an
ER_WRONG_ARGUMENTS
error occurs.
- +--------------------------------------------+
- | ST_AsText(ST_Buffer(@pt, 2, @pt_strategy)) |
- +--------------------------------------------+
- +--------------------------------------------+
- +---------------------------------------------------------------+
- | ST_AsText(ST_Buffer(@ls, 5, @end_strategy, @join_strategy)) |
- +---------------------------------------------------------------+
- | -5 5,-5 0,0 0,5 0,5 5)) |
- +---------------------------------------------------------------+
ST_Buffer_Strategy(
strategy
[,points_per_circle
])This function returns a strategy byte string for use with
ST_Buffer()
to influence buffer computation.Information about strategies is available at Boost.org.
The first argument must be a string indicating a strategy option:
For point strategies, permitted values are
'point_circle'
and'point_square'
.For join strategies, permitted values are
'join_round'
and'join_miter'
.For end strategies, permitted values are
'end_round'
and'end_flat'
.
If the first argument is
'point_circle'
,'join_round'
,'join_miter'
, or'end_round'
, thepoints_per_circle
argument must be given as a positive numeric value. The maximumpoints_per_circle
value is the value of themax_points_in_geometry
system variable.For examples, see the description of
ST_Buffer()
.ST_Buffer_Strategy()
handles its arguments as described in the introduction to this section, with these exceptions:If any argument is invalid, an
ER_WRONG_ARGUMENTS
error occurs.If the first argument is
'point_square'
or'end_flat'
, thepoints_per_circle
argument must not be given or anER_WRONG_ARGUMENTS
error occurs.
Returns a geometry that represents the convex hull of the geometry value
g
.This function computes a geometry's convex hull by first checking whether its vertex points are colinear. The function returns a linear hull if so, a polygon hull otherwise. This function processes geometry collections by extracting all vertex points of all components of the collection, creating a
MultiPoint
value from them, and computing its convex hull.ST_ConvexHull()
handles its arguments as described in the introduction to this section, with this exception:The return value is
NULL
for the additional condition that the argument is an empty geometry collection.
- +-----------------------------------------------+
- | ST_AsText(ST_ConvexHull(ST_GeomFromText(@g))) |
- +-----------------------------------------------+
- +-----------------------------------------------+
Returns a geometry that represents the point set difference of the geometry values
g1
andg2
.ST_Difference()
handles its arguments as described in the introduction to this section.Returns a geometry that represents the point set intersection of the geometry values
g1
andg2
.ST_Intersection()
handles its arguments as described in the introduction to this section.- +--------------------------------------+
- | ST_AsText(ST_Intersection(@g1, @g2)) |
- +--------------------------------------+
- +--------------------------------------+
Returns a geometry that represents the point set symmetric difference of the geometry values
g1
andg2
, which is defined as:g1 symdifference g2 := (g1 union g2) difference (g1 intersection g2)
Or, in function call notation:
ST_SymDifference(g1, g2) = ST_Difference(ST_Union(g1, g2), ST_Intersection(g1, g2))
ST_SymDifference()
handles its arguments as described in the introduction to this section.- +---------------------------------------+
- | ST_AsText(ST_SymDifference(@g1, @g2)) |
- +---------------------------------------+
- +---------------------------------------+
Transforms a geometry from one spatial reference system (SRS) to another. The return value is a geometry of the same type as the input geometry with all coordinates transformed to the target SRID,
target_srid
. Transformation support is limited to geographic SRSs, unless the SRID of the geometry argument is the same as the target SRID value, in which case the return value is the input geometry for any valid SRS.ST_Transform()
handles its arguments as described in the introduction to this section, with these exceptions:Geometry arguments that have an SRID value for a geographic SRS do not produce an error.
If the geometry or target SRID argument has an SRID value that refers to an undefined spatial reference system (SRS), an
ER_SRS_NOT_FOUND
error occurs.If the geometry is in an SRS that
ST_Transform()
cannot transform from, anER_TRANSFORM_SOURCE_SRS_NOT_SUPPORTED
error occurs.If the target SRID is in an SRS that
ST_Transform()
cannot transform to, anER_TRANSFORM_TARGET_SRS_NOT_SUPPORTED
error occurs.If the geometry is in an SRS that is not WGS 84 and has no TOWGS84 clause, an
ER_TRANSFORM_SOURCE_SRS_MISSING_TOWGS84
error occurs.If the target SRID is in an SRS that is not WGS 84 and has no TOWGS84 clause, an
ER_TRANSFORM_TARGET_SRS_MISSING_TOWGS84
error occurs.
ST_SRID(
andg
,target_srid
)ST_Transform(
differ as follows:g
,target_srid
)ST_SRID()
changes the geometry SRID value without transforming its coordinates.ST_Transform()
transforms the geometry coordinates in addition to changing its SRID value.
- +----------------------------+
- | ST_AsText(@p) |
- +----------------------------+
- +----------------------------+
- +---------------------------------------------+
- | ST_AsText(@p) |
- +---------------------------------------------+
- +---------------------------------------------+
Returns a geometry that represents the point set union of the geometry values
g1
andg2
.ST_Union()
handles its arguments as described in the introduction to this section.- +--------------------------------------+
- | ST_AsText(ST_Union(@g1, @g2)) |
- +--------------------------------------+
- +--------------------------------------+
In addition, Section 12.16.7, “Geometry Property Functions”, discusses several functions that construct new geometries from existing ones. See that section for descriptions of these functions:
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-spatial-operator-functions.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.