本文介绍了从Google地图.getBounds中获取MySQL数据库中的所有记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我有一个约1800行的数据库,每个数据库都有一个 lat 和 long 列,我是什么(33.564398518424134,-79.38014701875002),(35.375726155241175,-76.08424858125002)的结果类似于Google Maps V3 .getBounds )我想要做的是获取每个记录的lat&在数据库中的lng是在这些范围内。任何建议?



我想我必须外推地图的其他两个角落,因为 .getBounds 包含2个点(我猜想地图的两个角),我想要在4点以内。如果我这样做了,我最终会得到一个类似于......的数组。现在如果我错了,请纠正我,但这应该是地图上的NW,NE,SW,SE角落,以lat-lng。

  33.564398518424134,-79.38014701875002 
33.564398518424134,-76.08424858125002
35.375726155241175,-79.38014701875002
35.375726155241175,-76.08424858125002

好的,如果我有这些数据,我将如何构建一个查询来获取这些坐标中的行?表被称为 tilistings - 列是 lat 和 lng 。 ..如果有更简单的方法,或者我只是疯狂的我的方法,请随时让我知道。



谢谢

$ b $ (b,b),(c,d)) SELECT * FROM tilistings WHERE lat> AND lat< c AND lng> b AND lng< d


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 The result is something like ((33.564398518424134, -79.38014701875002), (35.375726155241175, -76.08424858125002)) What I want to do, is get every record whose lat & lng in the database is within those bounds. Any suggestions?

Im thinking I would have to extrapolate the other 2 corners of the map, since .getBounds only contains 2 points (2 corners of the map I suppose), and I would want to be within 4 points. If I did that I would end up with an array something like...Now correct me if I am wrong but this should be NW, NE, SW, SE corners of the map, in lat-lng.

33.564398518424134, -79.38014701875002
33.564398518424134, -76.08424858125002
35.375726155241175, -79.38014701875002
35.375726155241175, -76.08424858125002

Ok, so If I have this data, how would I build a query to get the rows that are within these coordinates? Table is called tilistings - columns are lat and lng ...also if there is an easier way, or I am just crazy with my methodology, please feel free to let me know.

Thanks

解决方案

if from Google: ( (a, b), (c, d) )

SELECT * FROM tilistings WHERE lat > a AND lat < c AND lng > b AND lng < d

这篇关于从Google地图.getBounds中获取MySQL数据库中的所有记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 02:30