Ok, so I have a very large database of property information, complete with geographic coordinates. What I need to be able to do is run a query that asks, "give me all properties that are inside a given rectangle or polygon." The user interface would allow the user to define the points of the rectangle or polygon (using a map system). These coordinates would go into the query and sql should return a list of properties in that area. If polygon isn't possible, at least a rectangle would be helpful. I already know how to do the radius search.
Appreciate any help you can provide.
Use
Within(geom1, geom2)
function to check if geom1 is spatially within geom2. Your query will look something like,Your sql code must be something like this
SQL Query
Table
Also be careful, for large table you must use MyISAM, because InnoDB not support SPATIAL indexes.
Note MySQL support ST_CONTAINS from 5.6+ version.
For more take a look at this, useful article http://www.mysqlperformanceblog.com/2013/10/21/using-the-new-spatial-functions-in-mysql-5-6-for-geo-enabled-applications/
MySQL support geometrical function and queries. Reference document would be helpful for you : https://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions.html