Rechercher dans le manuel MySQL
12.16.7.2 Point Property Functions
A Point
consists of X and Y coordinates,
which may be obtained using the
ST_X()
and
ST_Y()
functions, respectively.
These functions also permit an optional second argument that
specifies an X or Y coordinate value, in which case the function
result is the Point
object from the first
argument with the appropriate coordinate modified to be equal to
the second argument.
For Point
objects that have a geographic
spatial reference system (SRS), the longitude and latitude may
be obtained using the
ST_Longitude()
and
ST_Latitude()
functions,
respectively. These functions also permit an optional second
argument that specifies a longitude or latitude value, in which
case the function result is the Point
object
from the first argument with the longitude or latitude modified
to be equal to the second argument.
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 a valid geometry but not a
Point
object, anER_UNEXPECTED_GEOMETRY_TYPE
error occurs.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.If an X or Y coordinate argument is provided and the value is
-inf
,+inf
, orNaN
, anER_DATA_OUT_OF_RANGE
error occurs.If a longitude or latitude argument is out of range, an error occurs:
If any longitude argument is not in the range (−180, 180], an
ER_LONGITUDE_OUT_OF_RANGE
error occurs.If any latitude argument is not in the range [−90, 90], an
ER_LATITUDE_OUT_OF_RANGE
error occurs.
Ranges shown are in degrees. The exact range limits deviate slightly due to floating-point arithmetic.
Otherwise, the return value is non-
NULL
.
These functions are available for obtaining point properties:
ST_Latitude(
p
[,new_latitude_val
])With a single argument representing a valid
Point
objectp
that has a geographic spatial reference system (SRS),ST_Latitude()
returns the latitude value ofp
as a double-precision number.With the optional second argument representing a valid latitude value,
ST_Latitude()
returns aPoint
object like the first argument with its latitude equal to the second argument.ST_Latitude()
handles its arguments as described in the introduction to this section, with the addition that if thePoint
object is valid but does not have a geographic SRS, anER_SRS_NOT_GEOGRAPHIC
error occurs.- +------------------+
- | ST_Latitude(@pt) |
- +------------------+
- | 45 |
- +------------------+
- +---------------------------------+
- | ST_AsText(ST_Latitude(@pt, 10)) |
- +---------------------------------+
- +---------------------------------+
This function was added in MySQL 8.0.12.
ST_Longitude(
p
[,new_longitude_val
])With a single argument representing a valid
Point
objectp
that has a geographic spatial reference system (SRS),ST_Longitude()
returns the longitude value ofp
as a double-precision number.With the optional second argument representing a valid longitude value,
ST_Longitude()
returns aPoint
object like the first argument with its longitude equal to the second argument.ST_Longitude()
handles its arguments as described in the introduction to this section, with the addition that if thePoint
object is valid but does not have a geographic SRS, anER_SRS_NOT_GEOGRAPHIC
error occurs.- +-------------------+
- | ST_Longitude(@pt) |
- +-------------------+
- | 90 |
- +-------------------+
- +----------------------------------+
- | ST_AsText(ST_Longitude(@pt, 10)) |
- +----------------------------------+
- +----------------------------------+
This function was added in MySQL 8.0.12.
With a single argument representing a valid
Point
objectp
,ST_X()
returns the X-coordinate value ofp
as a double-precision number. As of MySQL 8.0.12, the X coordinate is considered to refer to the axis that appears first in thePoint
spatial reference system (SRS) definition.With the optional second argument,
ST_X()
returns aPoint
object like the first argument with its X coordinate equal to the second argument. As of MySQL 8.0.12, if thePoint
object has a geographic SRS, the second argument must be in the proper range for longitude or latitude values.ST_X()
handles its arguments as described in the introduction to this section.- +--------------------------+
- +--------------------------+
- | 56.7 |
- +--------------------------+
- +-------------------------------------------+
- +-------------------------------------------+
- +-------------------------------------------+
With a single argument representing a valid
Point
objectp
,ST_Y()
returns the Y-coordinate value ofp
as a double-precision number. As of MySQL 8.0.12, the Y coordinate is considered to refer to the axis that appears second in thePoint
spatial reference system (SRS) definition.With the optional second argument,
ST_Y()
returns aPoint
object like the first argument with its Y coordinate equal to the second argument. As of MySQL 8.0.12, if thePoint
object has a geographic SRS, the second argument must be in the proper range for longitude or latitude values.ST_Y()
handles its arguments as described in the introduction to this section.- +--------------------------+
- +--------------------------+
- | 53.34 |
- +--------------------------+
- +-------------------------------------------+
- +-------------------------------------------+
- +-------------------------------------------+
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 26/06/2006, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/mysql-rf-gis-point-property-functions.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.