-2

这是我的表的示例:

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

从我们的应用程序中,我以边界框格式返回 2 组纬度和对数点:

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

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

4

2 回答 2

0

获得重复的纬度和经度

WITH Dup_LatLong AS
(
SELECT row_number() OVER (PARTITION BY
LATITUDE, LONGITUDE ORDER BY Rpropid1) AS RowNumber, UniqueValue, convert(Varchar(50),LATITUDE)+convert(Varchar(50),LONGITUDE) Check_Cond
FROM YourTable)
Select UniqueValue,LATITUDE, LONGITUDE, convert(Varchar(50),LATITUDE)+convert(Varchar(50),LONGITUDE)
from YourTable
where convert(Varchar(50),LATITUDE)+convert(Varchar(50),LONGITUDE) in (Select Check_Cond from Dup_LatLong where RowNumber > 1)
order by 7
于 2013-08-30T05:02:41.903 回答
-1

这对我有用:

Select * from Addresses
Where Addresses.Longitude between -80.33313094482423 and  -79.5290690551758
And Addresses.Latitude between 32.6420709033305 and 32.91052662576775
于 2013-07-22T00:56:31.077 回答