What is a SPATIAL INDEX and when should I use it?

前端 未结 4 1498
感动是毒
感动是毒 2021-02-01 12:56

Like most of the average PHP web developers I use MySql as a RDBMS. MySql (as other RDBMS also) offers SPATIAL INDEX features, but I\'m don\'t get it very well. I have googled f

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-01 13:10

    When we need to store some geographic data for storing locations OR we need to store shape related data then we can use it.

    For Instance, Imagine that you are trying to develop an application that helps people find restaurants, pubs, bars and other hangout places near them. In nutshell, this will be a location discovery platform.

    Looking from a back-end perspective, we would be needing to store geographic data of these locations like Latitude and Longitude. Then we would need to write functions that calculate the distance between the user and the location (to show how far the location is from him/her). Using the same function, we can design an algorithm that finds closest places near to the user or within a given radius from him/her.

    You may find the better idea with example over here :- https://medium.com/sysf/playing-with-geometry-spatial-data-type-in-mysql-645b83880331

提交回复
热议问题