I have a spatial table.
I would generate the clossest by place.
I create the lenght of the distance between 2 points.
The first column retrieve the X-value
Second, the Y-value,
third an example of calculating the distance between 2 point.
Fouth retrieve NULL becouse he cannot working with the value astext(mas_xy_punten)
Fifthe, retrieve NULL, becouse, the same as column 4.
Can you explane why?
This is the querry!
SELECT X(mas_xy_punten),Y(mas_xy_punten),
GLength(GeomFromText('LineString(55.4444444444 1,80.23 23.12)'))as distance,
GLength(GeomFromText('LineString(55 1,astext(mas_xy_punten))')) as afstand,
GLength(GeomFromText('LineString(55 1,astext(X(mas_xy_punten)) astext(Y(mas_xy_punten)))')) as engte
FROM mas_xy
Where X(mas_xy_punten) <> "0"
This is a little dump of my table
CREATE TABLE `mas_xy` (
`mas_xy_id` int(11) NOT NULL auto_increment,
`mas_xy_mas_id` int(11) NOT NULL default '0',
`mas_xy_punten` point NOT NULL default '',
`mas_xy_tekst` varchar(64) collate latin1_general_ci NOT NULL default '',
PRIMARY KEY (`mas_xy_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=21 ;
INSERT INTO `mas_xy` VALUES (1, 1, 0x00000000010100000017e7ff7fa2821340a806002065364940, '');
INSERT INTO `mas_xy` VALUES (2, 2, 0x00000000010100000000000000000000000000000000000000, '');
INSERT INTO `mas_xy` VALUES (3, 3, 0x0000000001010000002c88ffbf239c054054f3ff5fda334840, '');
INSERT INTO `mas_xy` VALUES (4, 4, 0x000000000101000000461b002059821340fdf9ff7fdf294940, '');
INSERT INTO `mas_xy` VALUES (5, 5, 0x0000000001010000000826ffdf4de41340fc1900e06f3d4940, '');
INSERT INTO `mas_xy` VALUES (6, 6, 0x00000000010100000033d7ffbf050c14405d0200a0db394940, '');
INSERT INTO `mas_xy` VALUES (7, 7, 0x0000000001010000006245ff9f599313402b0b0080851c4940, '');
INSERT INTO `mas_xy` VALUES (8, 8, 0x0000000001010000006994ff9f3b6811402c0e00c065304940, '');
INSERT INTO `mas_xy` VALUES (9, 9, 0x0000000001010000000203004040431640dafdff3f5b444940, '');
INSERT INTO `mas_xy` VALUES (10, 10, 0x000000000101000000ccc2ff9f885622409e140000d4e94440, '');
INSERT INTO `mas_xy` VALUES (11, 11, 0x0000000001010000006d2000207e42224034faff5f36f44440, '');
INSERT INTO `mas_xy` VALUES (12, 12, 0x000000000101000000a8260080151f2240950500c0320c4540, '');
INSERT INTO `mas_xy` VALUES (13, 13, 0x000000000101000000ca6500c0dab42240ac0c00a065de4440, '');
INSERT INTO `mas_xy` VALUES (14, 14, 0x00000000010100000088edffbfd03f224030140040a6244540, '');
INSERT INTO `mas_xy` VALUES (15, 15, 0x00000000010100000012beff5f115e224081010020a0304540, '');
INSERT INTO `mas_xy` VALUES (16, 16, 0x000000000101000000f2070060cebe224028e5ff9f74ea4440, '');
INSERT INTO `mas_xy` VALUES (17, 17, 0x000000000101000000808400e021ad1240d5f4ff7f1a404940, '');
INSERT INTO `mas_xy` VALUES (18, 18, 0x000000000101000000453b0080a9361740f3e7ffffbd484940, '');
INSERT INTO `mas_xy` VALUES (19, 19, 0x000000000101000000bc8d0080f9c61640d61700206b5e4940, '');
INSERT INTO `mas_xy` VALUES (20, 20, 0x000000000101000000192d00c0439a21407af5ff1fdf014540, '');