Google map allows us to create radius in its map, user will drag and drop that radius in different location and he will able to show only those pointers which are search result in his selected criteria.
Visit this example : http://maps.forum.nu/gm_sensitive circle2.html to create radius in Google map.
Now we can get new updated radius value from JavaScript function.
We have to pass that amount to SQL Server stored procedure Below is that sql :
We will apply Google map’s new Latitude and Longitude value and radius area to the sql server’s stored procedure and it will return only those records which are satisfy that criteria.
Visit this example : http://maps.forum.nu/gm_sensitive circle2.html to create radius in Google map.
Now we can get new updated radius value from JavaScript function.
We have to pass that amount to SQL Server stored procedure Below is that sql :
CREATE PROCEDURE uspAddress_GetByRadius @Latitude decimal(10,8) ,@Longitude decimal(10,8) ,@Radius decimal(5,3) AS BEGIN DECLARE @R decimal(18,10) SET @R = PI()/180 SELECT ACOS((SIN(@Latitude*@R)* SIN(Latitude*@R)) + (COS(@Latitude*@R)* COS(Latitude*@R) * COS(Longitude*@R - @Longitude*@R))) * 6378.137 AS Distance ,A.* FROM (SELECT CONVERT(decimal(10,8), SUBSTRING(LMapCoordonates, 0, CHARINDEX(',',LMapCoordonates))) as Latitude ,CONVERT(decimal(10,8), SUBSTRING(LMapCoordonates, CHARINDEX(',',LMapCoordonates) + 1, 100)) as Longitude ,tblAddress.* FROM tblAddress) AS A WHERE ACOS((SIN(@Latitude*@R)* SIN(Latitude*@R)) + (COS(@Latitude*@R)* COS(Latitude*@R) * COS(Longitude*@R - @Longitude*@R))) * 6378.137 <= @Radius END
We will apply Google map’s new Latitude and Longitude value and radius area to the sql server’s stored procedure and it will return only those records which are satisfy that criteria.