为什么这个空间查询返回空?
Why is this spatial query returning empty?
使用下面的简单 table,我正在尝试 select 给定 POLYGON 中的 'latlng POINT'。但是 return 总是空的,我错过了什么?
CREATE TABLE mypoi (
id int not null auto_increment,
latlng POINT not null,
primary key(id)
)ENGINE=MyISM;
INSERT INTO mypoi VALUES
(1 , POINT( 39.274, -94.4233 )),
(2 , POINT( 39.5, -94.3483 ));
SELECT id, x(latlng), y(latlng)
FROM mypoi
WHERE MBRContains(GeomFromText('POLYGON((39.48025, -94.73566 , 39.48025, -94.09021 , 39.09122, -94.09021 , 39.09122, -94.73566))'),latlng);
WKT 多边形通过在点序列的末尾包含原始点来闭合。他们还用逗号分隔每个点(即 x1 y1, x2 y2, ..., x1 y1
)。多边形文本中存在一些格式问题。
SELECT id, x(latlng), y(latlng)
FROM mypoi
WHERE MBRContains(GeomFromText('POLYGON((39.48025 -94.73566, 39.48025 -94.09021, 39.09122 -94.09021, 39.09122 -94.73566, 39.48025 -94.73566))'),latlng);
使用下面的简单 table,我正在尝试 select 给定 POLYGON 中的 'latlng POINT'。但是 return 总是空的,我错过了什么?
CREATE TABLE mypoi (
id int not null auto_increment,
latlng POINT not null,
primary key(id)
)ENGINE=MyISM;
INSERT INTO mypoi VALUES
(1 , POINT( 39.274, -94.4233 )),
(2 , POINT( 39.5, -94.3483 ));
SELECT id, x(latlng), y(latlng)
FROM mypoi
WHERE MBRContains(GeomFromText('POLYGON((39.48025, -94.73566 , 39.48025, -94.09021 , 39.09122, -94.09021 , 39.09122, -94.73566))'),latlng);
WKT 多边形通过在点序列的末尾包含原始点来闭合。他们还用逗号分隔每个点(即 x1 y1, x2 y2, ..., x1 y1
)。多边形文本中存在一些格式问题。
SELECT id, x(latlng), y(latlng)
FROM mypoi
WHERE MBRContains(GeomFromText('POLYGON((39.48025 -94.73566, 39.48025 -94.09021, 39.09122 -94.09021, 39.09122 -94.73566, 39.48025 -94.73566))'),latlng);