Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is MySQL's the POINT() function documented?

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.

like image 219
vbence Avatar asked Dec 20 '22 03:12

vbence


2 Answers

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.

like image 160
Brian Roach Avatar answered Dec 26 '22 13:12

Brian Roach


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 Examples

Imagine 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.

like image 31
Danny Beckett Avatar answered Dec 26 '22 13:12

Danny Beckett