I get an mySQL error saying 'ADDRESS_LONGI_LATIT_LOCATION' can not be null. Likely that 'geomfromtext/pointfromtext' is returning a null. Whats wrong here? Any help is appreciated.
INSERT INTO address (ADDRESS_NICKNAME,ADDRESS_LONGI_LATIT_LOCATION)
VALUES ('Testing',geomfromtext('Point(10.20.45 34.23.79)'))
Another way
INSERT INTO address (ADDRESS_NICKNAME,ADDRESS_LONGI_LATIT_LOCATION)
VALUES ('Testing',pointfromtext('10.20.45 34.23.79'))
As per the specification of
ST_geomFromText()
(geomfromtext()
is a deprecated synonym, you should not use it):Indeed your argument is not syntactically well-formed, as each coordinate contains two dots. You can check this with a simple:
Result (try online):
With a single dot, it works:
Result (true online)
The same applies to
ST_PointFromText(()
, except you still need to use the WKT format so you need to usePOINT()
as well:Result (try online):
Basically the two functions are the same, except
pointfromtext()
enforces a point result.