从 MySQL 数据库中获取 Google Maps .getBounds 中的所有记录? [英] Get all records from MySQL database that are within Google Maps .getBounds?

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

问题描述

好的,我有一个大约有 1800 行的数据库,每行都有一列 latlong,我正在尝试做的是,它查询 Google Maps V3 .getBounds 结果类似于 ((33.564398518424134, -79.38014701875002), (35.375726155241175, -76.08424858125002) 我想要的代码是什么,我想要的记录是什么数据库中的 lng 在这些范围内.有什么建议吗?

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?

我想我必须推断地图的其他 2 个角,因为 .getBounds 只包含 2 个点(我想是地图的 2 个角),我希望在 4点.如果我这样做了,我最终会得到一个类似...的数组,如果我错了,请纠正我,但这应该是地图的 NW、NE、SW、SE 角,以纬度为单位.

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

好的,如果我有这些数据,我将如何构建查询来获取这些坐标内的行?表被称为 tilistings - 列是 latlng ...如果有更简单的方法,或者我只是对我的方法感到疯狂,请随时告诉我.

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.

谢谢

推荐答案

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

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

SELECT * FROM tilistings WHERE lat >a AND lat b AND lng

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆