It seems like besides using WKT and the GeomFromText function, MySQL support an other method of creating geometries. The function POINT()
is used in the examples in the documentation, but I can not find where the function itself is documented.
This one is pretty straightforward, but I wonder if there are any other functions which can be used as well, instead of parsing WKT strings.
MySQL has a spacial data type POINT
. It's a type that encapsulates an x and y value pair to represent a coordinate in some space.
You can create a table with a column of that type via:
CREATE TABLE my_table (pt POINT);
For every spacial type there's a "constructor" function(s) to create a value of that type. For example, Point(x,y)
- it returns a value of type POINT
to be stored in the db, used in another function, etc:
INSERT INTO my_table (pt) VALUES (Point(1,2));
The docs that cover the functions for creating values of these types (incl. the Point()
function) can be found at Creating spacial values and the section of the manual that it's in covers spacial types in general.
POINT
is not a function, it's a data type.
You use it like POINT(100, 20)
to give you a coordinate of x = 100, y = 20
.
It is documented at 12.16.2.3 Class Point:
A
Point
is a geometry that represents a single location in coordinate space.
Point
ExamplesImagine a large-scale map of the world with many cities. A
Point
object could represent each city.On a city map, a
Point
object could represent a bus stop.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With