2019. 11. 29. 15:05
[MSSQL] GeoLocation 범위계산
2019. 11. 29. 15:05 in 팁&테크/MSSQL
alter table [yourTable] add [p] as geography::Point(Latitude, Longitude, 4326) persisted;
create spatial index [yourSpatialIndex] on [yourTable] ([p])
declare @Latitude float = <somevalue>, @Longitude float = <somevalue>;
declare @point geography = geography::Point(@Latitude, @Longitude, 4326);
declare @distance int = <distance in meters>;
select * from [yourTable] where @point.STDistance([p]) <= @distance;