Get all records from MySQL database that are within Google Maps .getBounds?

前端 未结 10 1049
既然无缘
既然无缘 2020-12-02 12:53

Ok I have a database with about 1800 rows, each has a column lat and long, what I am trying to do, it query against Google Maps V3 .getBounds

10条回答
  •  天命终不由人
    2020-12-02 13:16

    Take a look at the new spatial data and functions available in MySQL 5.7, now also for InnoDB.

    Using the examples above, it takes about 1s for a table with 1 mio records to get the locations within a certain bounding box.

    With ST_Within() and ST_MakeEnvelope() and the correct spatial index I get the result in less the 0.01s.

提交回复
热议问题