In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the method of mysql to judge whether the point is in the designated polygon area, the article is very detailed, has a certain reference value, interested friends must read it!
1. Create a test table CREATE TABLE `zone` (`id` int (10) unsigned NOT NULL AUTO_INCREMENT, `polygongeo` polygon NOT NULL, PRIMARY KEY (`id`)) ENGINE=MYISAM DEFAULT CHARSET=utf8
Note: spatial indexes can only be created in tables where the storage engine is MYISAM
two。 Insert polygonal data insert into zone (polygongeo) values (POLYGONFROMTEXT ('POLYGON (11-5-5-5-5-1-1); 3. Determine whether the point is in the polygonal area
Test POINT (3,4)
Select AsText (polygongeo) from zone where MBRWithin (POLYGONFROMTEXT ('POINT (3 4)'), polygongeo)
Output: POLYGON ((1, 1, 5, 5, 5, 5, 5, 1, 1))
Indicates that the point POINT (3,4) is in the polygon region.
Test POINT (6, 1)
Select AsText (polygongeo) from zone where MBRWithin (POLYGONFROMTEXT ('POINT (61)'), polygongeo)
Output: empty
Indicates that the point POINT (6, 1) is in the polygon region
The above is all the contents of mysql's method to determine whether the point is in the specified polygon area. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 234
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.