在纬度/经度rectagle中返回结果 [英] Returning results within Latitude / Longitude rectagle

查看:144
本文介绍了在纬度/经度rectagle中返回结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的表格的一个例子:

  CREATE TABLE [dbo]。[Addresses](
[ Id] int NOT NULL IDENTITY(1,1),
[Latitude] float(53)NULL,
[Longitude] float(53)NULL




在我们的应用程序中,我以边界框格式返回两组纬度和纬度点:

  {upperright:[32.91052662576775,-79.5290690551758],lowerleft:[32.6420709033305,-80.33313094482423]} 

因此,根据边界框结果返回的内容,我需要将该信息传递给SQL查询以查找所有位于该边界内的地址长方形。

解决方案

这对我有效:

 从地址
中选择*其中Addresses.Longitude介于-80.33313094482423和-79.5290690551758
之间并且Addresses.Latitude介于32.6420709033305和32.91052662576775之间


Here is an example of my table:

CREATE TABLE [dbo].[Addresses] (
[Id] int NOT NULL IDENTITY(1,1) ,
[Latitude] float(53) NULL,
[Longitude] float(53) NULL
)

From our application I am getting back 2 sets of Latitude and Logitude Points in a bounding box format:

{"upperright":[32.91052662576775,-79.5290690551758],"lowerleft":[32.6420709033305,-80.33313094482423]}

So, based on what comes back in the bounding box results, I need to pass that information to an SQL query to find all of the addresses that are within that rectangle.

解决方案

This worked for me:

Select * from Addresses
Where Addresses.Longitude between -80.33313094482423 and  -79.5290690551758
And Addresses.Latitude between 32.6420709033305 and 32.91052662576775

这篇关于在纬度/经度rectagle中返回结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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