Pregunta

In a MySQL database, how do I find circular areas that fall entirely or partially within a certain distance from another point? There are plenty of examples to find points within a certain radius, but not circular areas that intersect that certain radius.

I have a list of contractors that service certain areas (point and radius). Customers need to be able to find these contractors based on a distance from them.

¿Fue útil?

Solución

I think you are looking for ST_Buffer, which will buffer a geometry by a certain distance. In your case this will turn your point into a circle, and you can then use ST_Intersects to find intersecting circles representing contractor areas.

Something like:

Select id from contractor c where intersects(c.geom, st_buffer(point, radius));

where obviously you need to provide values for point and a radius.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top