mysql-spatial

Query points within a given radius in MySQL

痞子三分冷 提交于 2019-11-28 19:52:10
I have created the following MySQL table to store latitude/longitude coordinates along with a name for each point: CREATE TABLE `points` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, `location` point NOT NULL, PRIMARY KEY (`id`), SPATIAL KEY `location` (`location`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; I am trying to query: all points within an n mile radius of a given point; the distance of each returned point from the given point All of the examples I have found refer to using a minimum bounding rectangle (MBR) rather than a radius. The

Query points within a given radius in MySQL

删除回忆录丶 提交于 2019-11-27 12:31:11
问题 I have created the following MySQL table to store latitude/longitude coordinates along with a name for each point: CREATE TABLE `points` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, `location` point NOT NULL, PRIMARY KEY (`id`), SPATIAL KEY `location` (`location`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; I am trying to query: all points within an n mile radius of a given point; the distance of each returned point from the given point All of