sql - Returning results within Latitude / Longitude rectagle -
here example of table:
create table [dbo].[addresses] ( [id] int not null identity(1,1) , [latitude] float(53) null, [longitude] float(53) null )
from our application getting 2 sets of latitude , logitude points in bounding box format:
{"upperright":[32.91052662576775,-79.5290690551758],"lowerleft":[32.6420709033305,-80.33313094482423]}
so, based on comes in bounding box results, need pass information sql query find of addresses within rectangle.
to duplicate latitude , longitude
with dup_latlong ( select row_number() on (partition latitude, longitude order rpropid1) rownumber, uniquevalue, convert(varchar(50),latitude)+convert(varchar(50),longitude) check_cond yourtable) select uniquevalue,latitude, longitude, convert(varchar(50),latitude)+convert(varchar(50),longitude) yourtable convert(varchar(50),latitude)+convert(varchar(50),longitude) in (select check_cond dup_latlong rownumber > 1) order 7
Comments
Post a Comment