Mysql retrieves polygonal data

I developed a site that stores spatial data in a mysql database, for example, in buildings, gardens, etc. in the form of polygons (latitude and longitude).

I want to know how to extract polygonal data in mysql.

I saw this sample query for inserting polygon data: http://amper.110mb.com/SPAT/mysql_initgeometry2.htm

But now I want to know how to retrieve data from a table based on certain restrictions, such as:

"where latitude < 9.33 and longitude > 22.4" Also, how to find if a point is inside or outside the polygon

+3
source share
1 answer

Here is a page with lots of examples: http://howto-use-mysql-spatial-ext.blogspot.com/

, :

SET @bbox = 'POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'; 
SELECT name, AsText(location) FROM Points
    WHERE Intersects( location, GeomFromText(@bbox) );

MySQL , (, ). , , , select.

+6

Source: https://habr.com/ru/post/1794349/


All Articles